Class: RSpec::Matchers::Has
- Inherits:
-
Object
- Object
- RSpec::Matchers::Has
- Defined in:
- lib/rspec/matchers/has.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected, *args) ⇒ Has
constructor
A new instance of Has.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected, *args) ⇒ Has
Returns a new instance of Has.
4 5 6 |
# File 'lib/rspec/matchers/has.rb', line 4 def initialize(expected, *args) @expected, @args = expected, args end |
Instance Method Details
#description ⇒ Object
20 21 22 |
# File 'lib/rspec/matchers/has.rb', line 20 def description [method_description(@expected), args_description].compact.join(' ') end |
#failure_message_for_should ⇒ Object
12 13 14 |
# File 'lib/rspec/matchers/has.rb', line 12 def "expected ##{predicate(@expected)}#{} to return true, got false" end |
#failure_message_for_should_not ⇒ Object
16 17 18 |
# File 'lib/rspec/matchers/has.rb', line 16 def "expected ##{predicate(@expected)}#{} to return false, got true" end |
#matches?(actual) ⇒ Boolean
8 9 10 |
# File 'lib/rspec/matchers/has.rb', line 8 def matches?(actual) actual.__send__(predicate(@expected), *@args) end |