Class: Shoulda::ActionController::Matchers::RenderWithLayout

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(layout) ⇒ RenderWithLayout

Returns a new instance of RenderWithLayout.



18
19
20
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 18

def initialize(layout)
  @layout = layout.to_s unless layout.nil?
end

Instance Method Details

#descriptionObject



35
36
37
38
39
40
41
42
43
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 35

def description
  description = "render with "
  if @layout.nil?
    description << "a layout"
  else
    description << "the #{@layout.inspect} layout"
  end
  description
end

#failure_messageObject



27
28
29
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 27

def failure_message
  "Expected #{expectation}, but #{result}"
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 22

def matches?(controller)
  @controller = controller
  rendered_with_layout? && rendered_with_expected_layout?
end

#negative_failure_messageObject



31
32
33
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 31

def negative_failure_message
  "Did not expect #{expectation}, but #{result}"
end