Class: Shoulda::Matchers::ActionController::RenderTemplateMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/shoulda/matchers/action_controller/render_template_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, message, context) ⇒ RenderTemplateMatcher

Returns a new instance of RenderTemplateMatcher.



47
48
49
50
51
52
53
54
55
# File 'lib/shoulda/matchers/action_controller/render_template_matcher.rb', line 47

def initialize(options, message, context)
  @options = options
  @message = message
  @template = options.is_a?(Hash) ? options[:partial] : options
  @context = context
  @controller = nil
  @failure_message = nil
  @failure_message_when_negated = nil
end

Instance Attribute Details

#failure_messageObject (readonly)

Returns the value of attribute failure_message.



45
46
47
# File 'lib/shoulda/matchers/action_controller/render_template_matcher.rb', line 45

def failure_message
  @failure_message
end

#failure_message_when_negatedObject (readonly)

Returns the value of attribute failure_message_when_negated.



45
46
47
# File 'lib/shoulda/matchers/action_controller/render_template_matcher.rb', line 45

def failure_message_when_negated
  @failure_message_when_negated
end

Instance Method Details

#descriptionObject



62
63
64
# File 'lib/shoulda/matchers/action_controller/render_template_matcher.rb', line 62

def description
  "render template #{@template}"
end

#in_context(context) ⇒ Object



66
67
68
69
# File 'lib/shoulda/matchers/action_controller/render_template_matcher.rb', line 66

def in_context(context)
  @context = context
  self
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
60
# File 'lib/shoulda/matchers/action_controller/render_template_matcher.rb', line 57

def matches?(controller)
  @controller = controller
  renders_template?
end