From 8170390f92e80539173f7b2a5b0fb1995baeea72 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Wed, 12 Apr 2017 20:22:47 +0200 Subject: [PATCH] fix rspecs --- spec/lib/wpscan/wpscan_options_spec.rb | 17 ----------------- spec/shared_examples/browser/options.rb | 4 ++-- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/spec/lib/wpscan/wpscan_options_spec.rb b/spec/lib/wpscan/wpscan_options_spec.rb index c60555c1..62bc34cf 100644 --- a/spec/lib/wpscan/wpscan_options_spec.rb +++ b/spec/lib/wpscan/wpscan_options_spec.rb @@ -186,23 +186,6 @@ describe 'WpscanOptions' do end end - describe '#basic_auth=' do - context 'invalid format' do - it 'should raise an error if the : is missing' do - expect { @wpscan_options.basic_auth = 'helloworld' }.to raise_error( - RuntimeError, 'Invalid basic authentication format, login:password expected' - ) - end - end - - context 'valid format' do - it "should add the 'Basic' word and do the encode64. See RFC 2617" do - @wpscan_options.basic_auth = 'Aladdin:open sesame' - expect(@wpscan_options.basic_auth).to eq 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' - end - end - end - describe '#has_options?' do it 'should return false' do expect(@wpscan_options.has_options?).to be_falsey diff --git a/spec/shared_examples/browser/options.rb b/spec/shared_examples/browser/options.rb index e9558620..010e0991 100644 --- a/spec/shared_examples/browser/options.rb +++ b/spec/shared_examples/browser/options.rb @@ -3,14 +3,14 @@ shared_examples 'Browser::Options' do describe '#basic_auth=' do - let(:exception) { 'Invalid basic authentication format, "login:password" or "Basic base_64_encoded" expected' } + let(:exception) { /^Invalid basic authentication format, "login:password" or "Basic base_64_encoded" expected. Your input: .+$/ } after do if @expected browser.basic_auth = @auth expect(browser.basic_auth).to eq @expected else - expect { browser.basic_auth = @auth }.to raise_error(exception) + expect { browser.basic_auth = @auth }.to raise_error(RuntimeError, exception) end end