Permalink
Browse files

small fixes to layout macros

  • Loading branch information...
Tammer Saleh
Tammer Saleh committed Sep 15, 2008
1 parent 2d858c0 commit 5ccbee0d81199f383ca05cb6c4ceffa78c6977a0
Showing with 12 additions and 4 deletions.
  1. +12 −4 lib/shoulda/controller/macros.rb
@@ -180,10 +180,18 @@ def should_render_template(template)
#
# should_render_with_layout 'special'
def should_render_with_layout(expected_layout = 'application')
- expected_layout ||= false
- should "render with #{expected_layout} layout" do
- response_layout = @response.layout.blank? ? false : @response.layout.split('/').last
- assert_equal expected_layout, response_layout, "Expected #{expected_layout} but was #{response_layout}"
+ if expected_layout
+ should "render with #{expected_layout} layout" do
+ response_layout = @response.layout.blank? ? "" : @response.layout.split('/').last
+ assert_equal expected_layout,
+ response_layout,
+ "Expected to render with layout #{expected_layout} but was rendered with #{response_layout}"
+ end
+ else
+ should "render without layout" do
+ assert_nil @response.layout,
+ "Expected no layout, but was rendered using #{@response.layout}"
+ end
end
end

0 comments on commit 5ccbee0

Please sign in to comment.