aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/activerecord
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2014-07-30 23:35:30 -0300
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2014-07-30 23:41:19 -0300
commit29a6a17a11cd98f18ad46e882cc8f7fd669de59f (patch)
treed51028412a4065bc94ceafb67510627944430482 /actionview/test/activerecord
parent811604f3f76294662854fbdbd3abc4e8e11d9685 (diff)
downloadrails-29a6a17a11cd98f18ad46e882cc8f7fd669de59f.tar.gz
rails-29a6a17a11cd98f18ad46e882cc8f7fd669de59f.tar.bz2
rails-29a6a17a11cd98f18ad46e882cc8f7fd669de59f.zip
Properly assert for the expected messages
The message passed to Minitest's assert_raise is used as output in case the assertion fails, but we can test against the exact message by using the actual exception object that is returned from the assert_raise call.
Diffstat (limited to 'actionview/test/activerecord')
-rw-r--r--actionview/test/activerecord/polymorphic_routes_test.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/actionview/test/activerecord/polymorphic_routes_test.rb b/actionview/test/activerecord/polymorphic_routes_test.rb
index fef27ef492..e220dcb8cb 100644
--- a/actionview/test/activerecord/polymorphic_routes_test.rb
+++ b/actionview/test/activerecord/polymorphic_routes_test.rb
@@ -158,34 +158,38 @@ class PolymorphicRoutesTest < ActionController::TestCase
def test_with_nil
with_test_routes do
- assert_raise ArgumentError, "Nil location provided. Can't build URI." do
+ exception = assert_raise ArgumentError do
polymorphic_url(nil)
end
+ assert_equal "Nil location provided. Can't build URI.", exception.message
end
end
def test_with_empty_list
with_test_routes do
- assert_raise ArgumentError, "Nil location provided. Can't build URI." do
+ exception = assert_raise ArgumentError do
polymorphic_url([])
end
+ assert_equal "Nil location provided. Can't build URI.", exception.message
end
end
def test_with_nil_id
with_test_routes do
- assert_raise ArgumentError, "Nil location provided. Can't build URI." do
+ exception = assert_raise ArgumentError do
polymorphic_url({ :id => nil })
end
+ assert_equal "Nil location provided. Can't build URI.", exception.message
end
end
def test_with_nil_in_list
with_test_routes do
- assert_raise ArgumentError, "Nil location provided. Can't build URI." do
+ exception = assert_raise ArgumentError do
@series.save
polymorphic_url([nil, @series])
end
+ assert_equal "Nil location provided. Can't build URI.", exception.message
end
end