Class: ExampleExpectations::ArbitraryMatcher
- Defined in:
- lib/vendor/plugins/rspec/spec/spec/expectations/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 |
# File 'lib/vendor/plugins/rspec/spec/spec/expectations/handler_spec.rb', line 6 def initialize(*args, &block) if args.last.is_a? Hash @expected = args.last[:expected] end @expected = block.call if block @block = block end |
Instance Method Details
#failure_message ⇒ Object
24 25 26 |
# File 'lib/vendor/plugins/rspec/spec/spec/expectations/handler_spec.rb', line 24 def "expected #{@expected}, got #{@target}" end |
#matches?(target) ⇒ Boolean
14 15 16 17 |
# File 'lib/vendor/plugins/rspec/spec/spec/expectations/handler_spec.rb', line 14 def matches?(target) @target = target return @expected == target end |
#negative_failure_message ⇒ Object
28 29 30 |
# File 'lib/vendor/plugins/rspec/spec/spec/expectations/handler_spec.rb', line 28 def "expected not #{@expected}, got #{@target}" end |
#with(new_value) ⇒ Object
19 20 21 22 |
# File 'lib/vendor/plugins/rspec/spec/spec/expectations/handler_spec.rb', line 19 def with(new_value) @expected = new_value self end |