Class: ExampleExpectations::ArbitraryMatcher
- Defined in:
- lib/gems/rspec-1.1.11/spec/spec/matchers/handler_spec.rb
Direct Known Subclasses
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(*args, &block) ⇒ ArbitraryMatcher
constructor
A new instance of ArbitraryMatcher.
- #matches?(target) ⇒ Boolean
- #negative_failure_message ⇒ Object
- #with(new_value) ⇒ Object
Constructor Details
#initialize(*args, &block) ⇒ ArbitraryMatcher
Returns a new instance of ArbitraryMatcher.
6 7 8 9 10 11 12 13 14 |
# File 'lib/gems/rspec-1.1.11/spec/spec/matchers/handler_spec.rb', line 6 def initialize(*args, &block) if args.last.is_a? Hash @expected = args.last[:expected] end if block_given? @expected = block.call end @block = block end |
Instance Method Details
#failure_message ⇒ Object
26 27 28 |
# File 'lib/gems/rspec-1.1.11/spec/spec/matchers/handler_spec.rb', line 26 def "expected #{@expected}, got #{@target}" end |
#matches?(target) ⇒ Boolean
16 17 18 19 |
# File 'lib/gems/rspec-1.1.11/spec/spec/matchers/handler_spec.rb', line 16 def matches?(target) @target = target return @expected == target end |
#negative_failure_message ⇒ Object
30 31 32 |
# File 'lib/gems/rspec-1.1.11/spec/spec/matchers/handler_spec.rb', line 30 def "expected not #{@expected}, got #{@target}" end |
#with(new_value) ⇒ Object
21 22 23 24 |
# File 'lib/gems/rspec-1.1.11/spec/spec/matchers/handler_spec.rb', line 21 def with(new_value) @expected = new_value self end |