Class: Spec::Matchers::Has
- Defined in:
- lib/vendor/plugins/rspec/lib/spec/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.
6 7 8 |
# File 'lib/vendor/plugins/rspec/lib/spec/matchers/has.rb', line 6 def initialize(expected, *args) @expected, @args = expected, args end |
Instance Method Details
#description ⇒ Object
22 23 24 |
# File 'lib/vendor/plugins/rspec/lib/spec/matchers/has.rb', line 22 def description "have key #{@args[0].inspect}" end |
#failure_message_for_should ⇒ Object
14 15 16 |
# File 'lib/vendor/plugins/rspec/lib/spec/matchers/has.rb', line 14 def "expected ##{predicate(@expected)}(#{@args[0].inspect}) to return true, got false" end |
#failure_message_for_should_not ⇒ Object
18 19 20 |
# File 'lib/vendor/plugins/rspec/lib/spec/matchers/has.rb', line 18 def "expected ##{predicate(@expected)}(#{@args[0].inspect}) to return false, got true" end |
#matches?(actual) ⇒ Boolean
10 11 12 |
# File 'lib/vendor/plugins/rspec/lib/spec/matchers/has.rb', line 10 def matches?(actual) actual.__send__(predicate(@expected), *@args) end |