Class: Spec::Matchers::Has
- Defined in:
- lib/gems/rspec-1.1.11/lib/spec/matchers/has.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(sym, *args) ⇒ Has
constructor
A new instance of Has.
- #matches?(given) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(sym, *args) ⇒ Has
Returns a new instance of Has.
5 6 7 8 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/has.rb', line 5 def initialize(sym, *args) @sym = sym @args = args end |
Instance Method Details
#description ⇒ Object
22 23 24 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/has.rb', line 22 def description "have key #{@args[0].inspect}" end |
#failure_message ⇒ Object
14 15 16 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/has.rb', line 14 def "expected ##{predicate}(#{@args[0].inspect}) to return true, got false" end |
#matches?(given) ⇒ Boolean
10 11 12 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/has.rb', line 10 def matches?(given) given.__send__(predicate, *@args) end |
#negative_failure_message ⇒ Object
18 19 20 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/has.rb', line 18 def "expected ##{predicate}(#{@args[0].inspect}) to return false, got true" end |