Class: RSpec::Rails::Matchers::RenderTemplate::RenderTemplateMatcher

Inherits:
Object
  • Object
show all
Includes:
Matchers::BaseMatcher
Defined in:
lib/rspec/rails/matchers/render_template.rb

Instance Method Summary collapse

Constructor Details

#initialize(scope, expected, message = nil) ⇒ RenderTemplateMatcher

Returns a new instance of RenderTemplateMatcher.



6
7
8
9
10
# File 'lib/rspec/rails/matchers/render_template.rb', line 6

def initialize(scope, expected, message=nil)
  super(Symbol === expected ? expected.to_s : expected)
  @message = message
  @scope = scope
end

Instance Method Details

#failure_message_for_shouldObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/rspec/rails/matchers/render_template.rb', line 20

def failure_message_for_should
  rescued_exception.message
end

#failure_message_for_should_notObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/rspec/rails/matchers/render_template.rb', line 25

def failure_message_for_should_not
  "expected not to render #{expected.inspect}, but did"
end

#matches?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/rspec/rails/matchers/render_template.rb', line 13

def matches?(*)
  match_unless_raises ActiveSupport::TestCase::Assertion do
    @scope.assert_template expected, @message
  end
end