Add spec for userpass_file

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

View File

@ -60,6 +60,26 @@ describe Metasploit::Framework::CredentialCollection do
end
end
context "when given a userspass_file" do
let(:username) { nil }
let(:password) { nil }
let(:userpass_file) do
filename = "foo"
stub_file = StringIO.new("asdf jkl\nfoo bar\n")
File.stub(:open).with(filename,/^r/).and_yield stub_file
filename
end
specify do
expect { |b| collection.each(&b) }.to yield_successive_args(
Metasploit::Framework::Credential.new(public: "asdf", private: "jkl"),
Metasploit::Framework::Credential.new(public: "foo", private: "bar"),
)
end
end
end
end