Class: RSpec::Matchers::BuiltIn::Has
- Inherits:
-
Object
- Object
- RSpec::Matchers::BuiltIn::Has
- Defined in:
- lib/rspec/matchers/built_in/has.rb
Instance Method Summary (collapse)
- - (Object) description
- - (Object) failure_message_for_should
- - (Object) failure_message_for_should_not
-
- (Has) initialize(expected, *args)
constructor
A new instance of Has.
- - (Boolean) matches?(actual) (also: #==)
Constructor Details
- (Has) initialize(expected, *args)
A new instance of Has
5 6 7 |
# File 'lib/rspec/matchers/built_in/has.rb', line 5 def initialize(expected, *args) @expected, @args = expected, args end |
Instance Method Details
- (Object) description
22 23 24 |
# File 'lib/rspec/matchers/built_in/has.rb', line 22 def description [method_description(@expected), args_description].compact.join(' ') end |
- (Object) failure_message_for_should
14 15 16 |
# File 'lib/rspec/matchers/built_in/has.rb', line 14 def "expected ##{predicate(@expected)}#{} to return true, got false" end |
- (Object) failure_message_for_should_not
18 19 20 |
# File 'lib/rspec/matchers/built_in/has.rb', line 18 def "expected ##{predicate(@expected)}#{} to return false, got true" end |
- (Boolean) matches?(actual) Also known as: ==
9 10 11 |
# File 'lib/rspec/matchers/built_in/has.rb', line 9 def matches?(actual) actual.__send__(predicate(@expected), *@args) end |