Add spec for pass_file

bug/bundler_fix
James Lee 2014-06-05 11:51:11 -05:00
parent b1136752be
commit 45c26343a1
No known key found for this signature in database
GPG Key ID: 2D6094C7CEA0A321
1 changed files with 23 additions and 0 deletions

View File

@ -9,12 +9,16 @@ describe Metasploit::Framework::CredentialCollection do
username: username,
password: password,
user_file: user_file,
pass_file: pass_file,
userpass_file: userpass_file,
)
end
let(:username) { "user" }
let(:password) { "pass" }
let(:user_file) { nil }
let(:pass_file) { nil }
let(:userpass_file) { nil }
specify do
expect { |b| collection.each(&b) }.to yield_with_args(Metasploit::Framework::Credential)
@ -37,6 +41,25 @@ describe Metasploit::Framework::CredentialCollection do
)
end
end
context "when given a pass_file and username" do
let(:password) { nil }
let(:pass_file) do
filename = "foo"
stub_file = StringIO.new("asdf\njkl\n")
File.stub(:open).with(filename,/^r/).and_return stub_file
filename
end
specify do
expect { |b| collection.each(&b) }.to yield_successive_args(
Metasploit::Framework::Credential.new(public: username, private: "asdf"),
Metasploit::Framework::Credential.new(public: username, private: "jkl"),
)
end
end
end
end