public Method

ResponseAssertions.assert_template(expected = nil, message=nil)

Asserts that the request was rendered with the appropriate template file.

Examples

# assert that the "new" view template was rendered
assert_template "new"

Source Code

# File action_controller/assertions/response_assertions.rb, line 136
def assert_template(expected = nil, message=nil)
  clean_backtrace do
    rendered = expected ? @response.rendered_file(!expected.include?('/')) : @response.rendered_file
    msg = build_message(message, "expecting <?> but rendering with <?>", expected, rendered)
    assert_block(msg) do
      if expected.nil?
        !@response.rendered_with_file?
      else
        expected == rendered
      end
    end
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.