aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-09-05 16:47:00 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-09-05 16:47:00 -0300
commit67117f7c5d2ece5494191e937de91d353609e963 (patch)
tree71ee9b40b7bcbadca61f8241b244f12c5876262d /actionpack
parent2bb19fa7392fd572beb6c0a9b19af70780c36e74 (diff)
downloadrails-67117f7c5d2ece5494191e937de91d353609e963.tar.gz
rails-67117f7c5d2ece5494191e937de91d353609e963.tar.bz2
rails-67117f7c5d2ece5494191e937de91d353609e963.zip
Add test to assert_recognizes with custom message
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/dispatch/routing_assertions_test.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/test/dispatch/routing_assertions_test.rb b/actionpack/test/dispatch/routing_assertions_test.rb
index 2116aa2746..56ea644f22 100644
--- a/actionpack/test/dispatch/routing_assertions_test.rb
+++ b/actionpack/test/dispatch/routing_assertions_test.rb
@@ -74,13 +74,21 @@ class RoutingAssertionsTest < ActionController::TestCase
assert_recognizes({ :controller => 'query_articles', :action => 'index', :use_query => 'true' }, '/query/articles', { :use_query => 'true' })
end
+ def test_assert_recognizes_raises_message
+ err = assert_raise(Assertion) do
+ assert_recognizes({ :controller => 'secure_articles', :action => 'index' }, 'http://test.host/secure/articles', {}, "This is a really bad msg")
+ end
+
+ assert_match err.message, "This is a really bad msg"
+ end
+
def test_assert_routing
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")
+ 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"