changing Credential == operator

it should no longer raise no method errors when comparing a credential to
an object that doesnt respond to public, private, or realm
bug/bundler_fix
darkbushido 2014-07-23 16:17:09 -05:00
parent 6c1a3f4992
commit 064d624322
No known key found for this signature in database
GPG Key ID: 3922EB70FB80E8DD
2 changed files with 9 additions and 2 deletions

View File

@ -78,7 +78,9 @@ module Metasploit
end end
def ==(other) def ==(other)
other.public == self.public && other.private == self.private && other.realm == self.realm other.respond_to?(:public) && other.public == self.public &&
other.respond_to?(:private) && other.private == self.private &&
other.respond_to?(:realm) && other.realm == self.realm
end end
def to_credential def to_credential

View File

@ -132,6 +132,11 @@ describe Metasploit::Framework::Credential do
expect(other).not_to eq(cred_detail) expect(other).not_to eq(cred_detail)
end end
end end
context "when comparing to a different object" do
let(:other) {'a string'}
specify do
expect(other).not_to eq(cred_detail)
end
end
end end
end end