7

In Rails 2 I would do

  def assert_layout(layout_name)
    assert_equal layout_name, @response.layout
  end

and:

 assert_layout 'layouts/layout_name'

This doesn't work in rails 3 anymore (undefined method `layout'). How should I change the custom assert_layout method?

deb
  • 12,326
  • 21
  • 67
  • 86

2 Answers2

11

Use assert_template 'layouts/layout_name'

Wizard of Ogz
  • 12,543
  • 2
  • 41
  • 43
2

Also I've found that if you're doing a test for nil layout you have to do the following...

assert_template :layout => nil
Subimage
  • 4,393
  • 3
  • 24
  • 18