class Shoulda::Matchers::ActionController::RenderTemplateMatcher

@private

Attributes

failure_message[R]
failure_message_for_should[R]
failure_message_for_should_not[R]
failure_message_when_negated[R]

Public Class Methods

new(options, message, context) click to toggle source
# File lib/shoulda/matchers/action_controller/render_template_matcher.rb, line 45
def initialize(options, message, context)
  @options = options
  @message = message
  @template = options.is_a?(Hash) ? options[:partial] : options
  @context  = context
end

Public Instance Methods

description() click to toggle source
# File lib/shoulda/matchers/action_controller/render_template_matcher.rb, line 57
def description
  "render template #{@template}"
end
in_context(context) click to toggle source
# File lib/shoulda/matchers/action_controller/render_template_matcher.rb, line 61
def in_context(context)
  @context = context
  self
end
matches?(controller) click to toggle source
# File lib/shoulda/matchers/action_controller/render_template_matcher.rb, line 52
def matches?(controller)
  @controller = controller
  renders_template?
end

Private Instance Methods

renders_template?() click to toggle source
# File lib/shoulda/matchers/action_controller/render_template_matcher.rb, line 68
def renders_template?
  begin
    @context.__send__(:assert_template, @options, @message)
    @failure_message_when_negated = "Didn't expect to render #{@template}"
    true
  rescue Shoulda::Matchers::AssertionError => error
    @failure_message = error.message
    false
  end
end