Class: Spec::Matchers::RespondTo
- Defined in:
- lib/spec/matchers/respond_to.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(sym) ⇒ RespondTo
constructor
A new instance of RespondTo.
- #matches?(target) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(sym) ⇒ RespondTo
Returns a new instance of RespondTo.
5 6 7 |
# File 'lib/spec/matchers/respond_to.rb', line 5 def initialize(sym) @sym = sym end |
Instance Method Details
#description ⇒ Object
21 22 23 |
# File 'lib/spec/matchers/respond_to.rb', line 21 def description "respond to ##{@sym.to_s}" end |
#failure_message ⇒ Object
13 14 15 |
# File 'lib/spec/matchers/respond_to.rb', line 13 def "expected target to respond to #{@sym.inspect}" end |
#matches?(target) ⇒ Boolean
9 10 11 |
# File 'lib/spec/matchers/respond_to.rb', line 9 def matches?(target) return target.respond_to?(@sym) end |
#negative_failure_message ⇒ Object
17 18 19 |
# File 'lib/spec/matchers/respond_to.rb', line 17 def "expected target not to respond to #{@sym.inspect}" end |