Class: Spec::Rails::Matchers::PresentMatcher
- Inherits:
-
Object
- Object
- Spec::Rails::Matchers::PresentMatcher
- Defined in:
- lib/presenter/rspec.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(presenter, format) ⇒ PresentMatcher
constructor
A new instance of PresentMatcher.
- #matches?(response) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(presenter, format) ⇒ PresentMatcher
Returns a new instance of PresentMatcher.
6 7 8 9 |
# File 'lib/presenter/rspec.rb', line 6 def initialize(presenter, format) @presenter = presenter @format = format end |
Instance Method Details
#failure_message ⇒ Object
17 18 19 |
# File 'lib/presenter/rspec.rb', line 17 def "Expected #{@expect.inspect}, found #{@actual.inspect}" end |
#matches?(response) ⇒ Boolean
11 12 13 14 15 |
# File 'lib/presenter/rspec.rb', line 11 def matches?(response) @expect = response.body @actual = @presenter.send("to_#{@format.to_sym}") @actual == @expect end |
#negative_failure_message ⇒ Object
21 22 23 |
# File 'lib/presenter/rspec.rb', line 21 def "Found unexpected #{@actual.inspect}" end |