diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-07-13 18:10:36 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-07-13 18:10:36 -0700 |
commit | 908bc79729fdb3cc2acbd346d9ed34c9286d57cc (patch) | |
tree | b227d738f5a21dcbf8277962c8deeb79cabc6b3b /actionpack/test/assertions | |
parent | d9fe10cb8ab05f6575a06f14991cd938052227dd (diff) | |
download | rails-908bc79729fdb3cc2acbd346d9ed34c9286d57cc.tar.gz rails-908bc79729fdb3cc2acbd346d9ed34c9286d57cc.tar.bz2 rails-908bc79729fdb3cc2acbd346d9ed34c9286d57cc.zip |
use a lookup table for `assert_response`
We shouldn't depend on specific methods imlemented in the TestResponse
subclass because the response could actually be a real response object.
In the future, we should either push the aliased predicate methods in
TestResponse up to the real response object, or remove them
Diffstat (limited to 'actionpack/test/assertions')
-rw-r--r-- | actionpack/test/assertions/response_assertions_test.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/test/assertions/response_assertions_test.rb b/actionpack/test/assertions/response_assertions_test.rb index 5e64cae7e2..82c747680d 100644 --- a/actionpack/test/assertions/response_assertions_test.rb +++ b/actionpack/test/assertions/response_assertions_test.rb @@ -7,7 +7,7 @@ module ActionDispatch include ResponseAssertions FakeResponse = Struct.new(:response_code) do - [:success, :missing, :redirect, :error].each do |sym| + [:successful, :not_found, :redirection, :server_error].each do |sym| define_method("#{sym}?") do sym == response_code end @@ -16,7 +16,7 @@ module ActionDispatch def test_assert_response_predicate_methods [:success, :missing, :redirect, :error].each do |sym| - @response = FakeResponse.new sym + @response = FakeResponse.new RESPONSE_PREDICATES[sym].to_s.sub(/\?/, '').to_sym assert_response sym assert_raises(Minitest::Assertion) { |