Class: Shoulda::ActionController::Matchers::RenderWithLayout
- Inherits:
-
Object
- Object
- Shoulda::ActionController::Matchers::RenderWithLayout
- Defined in:
- lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#in_context(context) ⇒ Object
Used to provide access to layouts recorded by ActionController::TemplateAssertions in Rails 3.
-
#initialize(expected_layout) ⇒ RenderWithLayout
constructor
A new instance of RenderWithLayout.
- #matches?(controller) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(expected_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(expected_layout) @expected_layout = expected_layout.to_s unless expected_layout.nil? end |
Instance Method Details
#description ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 42 def description description = "render with " if @expected_layout.nil? description << "a layout" else description << "the #{@expected_layout.inspect} layout" end description end |
#failure_message ⇒ Object
34 35 36 |
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 34 def "Expected #{expectation}, but #{result}" end |
#in_context(context) ⇒ Object
Used to provide access to layouts recorded by ActionController::TemplateAssertions in Rails 3
24 25 26 27 |
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 24 def in_context(context) @context = context self end |
#matches?(controller) ⇒ Boolean
29 30 31 32 |
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 29 def matches?(controller) @controller = controller rendered_with_layout? && rendered_with_expected_layout? end |
#negative_failure_message ⇒ Object
38 39 40 |
# File 'lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb', line 38 def "Did not expect #{expectation}, but #{result}" end |