Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

assert_template: validating option keys

  • Loading branch information...
commit 3f2c011d319de8f188b98c286db3786990856de0 1 parent 4d0dc53
Roberto Soares authored
4 actionpack/CHANGELOG.md
Source Rendered
... ... @@ -1,6 +1,8 @@
1 1 ## Rails 4.0.0 (unreleased) ##
2 2
3   -* `assert_template` is no more passing with empty string.
  3 +* `assert_template`:
  4 + - is no more passing with empty string.
  5 + - is now validating option keys. It accepts: `:layout`, `:partial`, `:locals` and `:count`.
4 6
5 7 *Roberto Soares*
6 8
2  actionpack/lib/action_controller/test_case.rb
@@ -106,6 +106,8 @@ def assert_template(options = {}, message = nil)
106 106 end
107 107 assert matches_template, msg
108 108 when Hash
  109 + options.assert_valid_keys(:layout, :partial, :locals, :count)
  110 +
109 111 if options.key?(:layout)
110 112 expected_layout = options[:layout]
111 113 msg = message || sprintf("expecting layout <%s> but action rendered <%s>",
6 actionpack/test/controller/action_pack_assertions_test.rb
@@ -430,6 +430,12 @@ def test_assert_response_failure_response_with_no_exception
430 430 class AssertTemplateTest < ActionController::TestCase
431 431 tests ActionPackAssertionsController
432 432
  433 + def test_with_invalid_hash_keys_raises_argument_error
  434 + assert_raise(ArgumentError) do
  435 + assert_template foo: "bar"
  436 + end
  437 + end
  438 +
433 439 def test_with_partial
434 440 get :partial
435 441 assert_template :partial => '_partial'

0 comments on commit 3f2c011

Please sign in to comment.
Something went wrong with that request. Please try again.