make shared example usage more readable

this seems less obtuse
bug/bundler_fix
David Maloney 2014-07-10 12:58:13 -05:00
parent 818bd1946d
commit 8833429987
No known key found for this signature in database
GPG Key ID: DEDBA9DC3A913DB2
17 changed files with 21 additions and 22 deletions

View File

@ -6,7 +6,7 @@ describe Metasploit::Framework::LoginScanner::AFP do
subject(:scanner) { described_class.new }
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it { should respond_to :login_timeout }

View File

@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/axis2'
describe Metasploit::Framework::LoginScanner::Axis2 do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::LoginScanner::HTTP'

View File

@ -9,7 +9,7 @@ describe Metasploit::Framework::LoginScanner::DB2 do
}
subject(:login_scanner) { described_class.new }
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
context '#attempt_login' do

View File

@ -45,7 +45,7 @@ describe Metasploit::Framework::LoginScanner::FTP do
described_class.new
}
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'

View File

@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/http'
describe Metasploit::Framework::LoginScanner::HTTP do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::LoginScanner::HTTP'

View File

@ -32,7 +32,7 @@ describe Metasploit::Framework::LoginScanner::MSSQL do
subject(:login_scanner) { described_class.new }
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::LoginScanner::NTLM'

View File

@ -30,7 +30,7 @@ describe Metasploit::Framework::LoginScanner::MySQL do
subject(:login_scanner) { described_class.new }
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
context '#attempt_login' do

View File

@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/pop3'
describe Metasploit::Framework::LoginScanner::POP3 do
subject(:scanner) { described_class.new }
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
context "#attempt_login" do

View File

@ -25,7 +25,7 @@ describe Metasploit::Framework::LoginScanner::Postgres do
subject(:login_scanner) { described_class.new }
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true
context '#attempt_login' do
context 'when the login is successful' do

View File

@ -32,7 +32,7 @@ describe Metasploit::Framework::LoginScanner::SMB do
subject(:login_scanner) { described_class.new }
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::LoginScanner::NTLM'

View File

@ -29,7 +29,7 @@ describe Metasploit::Framework::LoginScanner::SNMP do
described_class.new
}
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
context '#attempt_login' do

View File

@ -55,7 +55,7 @@ describe Metasploit::Framework::LoginScanner::SSH do
described_class.new
}
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it { should respond_to :verbosity }

View File

@ -5,7 +5,7 @@ describe Metasploit::Framework::LoginScanner::Telnet do
subject(:login_scanner) { described_class.new }
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it { should respond_to :banner_timeout }

View File

@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/tomcat'
describe Metasploit::Framework::LoginScanner::Tomcat do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::LoginScanner::HTTP'

View File

@ -12,7 +12,7 @@ describe Metasploit::Framework::LoginScanner::VNC do
}
subject(:login_scanner) { described_class.new }
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', false, false
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: false, has_default_realm: false
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'

View File

@ -4,7 +4,7 @@ require 'metasploit/framework/login_scanner/winrm'
describe Metasploit::Framework::LoginScanner::WinRM do
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', true, true
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: true
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
it_behaves_like 'Metasploit::Framework::LoginScanner::HTTP'

View File

@ -1,5 +1,5 @@
shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_key, has_default_realm |
shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | opts |
subject(:login_scanner) { described_class.new }
@ -295,7 +295,7 @@ shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_k
context '#each_credential' do
if has_realm_key
if opts[:has_realm_key]
context 'when the login_scanner has a REALM_KEY' do
context 'when the credential has a realm' do
before(:each) do
@ -308,7 +308,7 @@ shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_k
end
end
if has_default_realm
if opts[:has_default_realm]
context 'when the credential has no realm' do
before(:each) do
login_scanner.cred_details = [pub_pri]
@ -323,9 +323,7 @@ shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_k
end
end
end
unless has_realm_key
else
context 'when login_scanner has no REALM_KEY' do
context 'when the credential has a realm' do
before(:each) do
@ -353,6 +351,7 @@ shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | has_realm_k
end
end
end