diff options
author | Earl St Sauver <estsauver@gmail.com> | 2014-04-29 18:26:16 -0700 |
---|---|---|
committer | Earl St Sauver <estsauver@gmail.com> | 2014-04-29 18:34:56 -0700 |
commit | 31c3eec05d2ad50f93f3e7a7bc30ec33f2a5c768 (patch) | |
tree | 0a2c4681b3c18babebfdc576d4017e49cbdd8daa /actionpack/test | |
parent | 7b493d40eff924e76e23804adae7b711140e5082 (diff) | |
download | rails-31c3eec05d2ad50f93f3e7a7bc30ec33f2a5c768.tar.gz rails-31c3eec05d2ad50f93f3e7a7bc30ec33f2a5c768.tar.bz2 rails-31c3eec05d2ad50f93f3e7a7bc30ec33f2a5c768.zip |
Propagate test messages through assert_routing helper, Fixes #14908
assert_routing was not raising the message passed into the assertion
violation that it raised. This change propagates messages through
the on_fail error.
This fixes this error:
https://github.com/rails/rails/issues/14908
A test case for this issue is located here.
https://github.com/estsauver/test14908
To see that test case fail in the example app, just run
ruby -Itest test/controllers/guests_controller_test.rb
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/routing_assertions_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_assertions_test.rb b/actionpack/test/dispatch/routing_assertions_test.rb index aea4489852..2116aa2746 100644 --- a/actionpack/test/dispatch/routing_assertions_test.rb +++ b/actionpack/test/dispatch/routing_assertions_test.rb @@ -78,6 +78,14 @@ class RoutingAssertionsTest < ActionController::TestCase assert_routing('/articles', :controller => 'articles', :action => 'index') end + def test_assert_routing_raises_message + err = assert_raise(Assertion) do + assert_routing('/thisIsNotARoute', { :controller => 'articles', :action => 'edit', :id => '1' }, { :id => '1' }, {}, "This is a really bad msg") + end + + assert_match err.message, "This is a really bad msg" + end + def test_assert_routing_with_defaults assert_routing('/articles/1/edit', { :controller => 'articles', :action => 'edit', :id => '1' }, { :id => '1' }) end |