Class: Shoulda::Matchers::ActionController::RenderWithLayoutMatcher
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActionController::RenderWithLayoutMatcher
- Defined in:
- lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#in_context(context) ⇒ Object
Used to provide access to layouts recorded by ActionController::TemplateAssertions in Rails 3.
-
#initialize(expected_layout) ⇒ RenderWithLayoutMatcher
constructor
A new instance of RenderWithLayoutMatcher.
- #matches?(controller) ⇒ Boolean
Constructor Details
#initialize(expected_layout) ⇒ RenderWithLayoutMatcher
Returns a new instance of RenderWithLayoutMatcher.
66 67 68 69 70 71 72 73 74 |
# File 'lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb', line 66 def initialize(expected_layout) @expected_layout = if expected_layout expected_layout.to_s else nil end @controller = nil end |
Instance Method Details
#description ⇒ Object
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb', line 96 def description String.new('render with ').tap do |string| string << if @expected_layout.nil? 'a layout' else "the #{@expected_layout.inspect} layout" end end end |
#failure_message ⇒ Object
88 89 90 |
# File 'lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb', line 88 def "Expected #{expectation}, but #{result}" end |
#failure_message_when_negated ⇒ Object
92 93 94 |
# File 'lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb', line 92 def "Did not expect #{expectation}, but #{result}" end |
#in_context(context) ⇒ Object
Used to provide access to layouts recorded by ActionController::TemplateAssertions in Rails 3
78 79 80 81 |
# File 'lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb', line 78 def in_context(context) @context = context self end |
#matches?(controller) ⇒ Boolean
83 84 85 86 |
# File 'lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb', line 83 def matches?(controller) @controller = controller rendered_with_layout? && rendered_with_expected_layout? end |