diff options
author | Tim Haines <tmhaines@gmail.com> | 2008-08-29 22:09:51 +1200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-08-29 20:51:47 +0200 |
commit | d0b949d87375ae351757adffd192d8cb1f3dbf8d (patch) | |
tree | 4c485a7daf4e3274e428407a53d14d2eabddeb14 /actionpack/test/controller | |
parent | a200c67611ed3bb2d276a9a1d1eb67b5c926f22a (diff) | |
download | rails-d0b949d87375ae351757adffd192d8cb1f3dbf8d.tar.gz rails-d0b949d87375ae351757adffd192d8cb1f3dbf8d.tar.bz2 rails-d0b949d87375ae351757adffd192d8cb1f3dbf8d.zip |
Improve assert_select_rjs failure messages for show, hide, toggle, and remove
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#931 state:committed]
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/assert_select_test.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb index 1531e7c21a..cce8f8dc21 100644 --- a/actionpack/test/controller/assert_select_test.rb +++ b/actionpack/test/controller/assert_select_test.rb @@ -433,6 +433,17 @@ class AssertSelectTest < Test::Unit::TestCase assert_select_rjs :remove, "test1" end + def test_assert_select_rjs_for_remove_offers_useful_error_when_assertion_fails + render_rjs do |page| + page.remove "test_with_typo" + end + + assert_select_rjs :remove, "test1" + + rescue Test::Unit::AssertionFailedError + assert_equal "No RJS statement that removes 'test1' was rendered.", $!.message + end + def test_assert_select_rjs_for_remove_ignores_block render_rjs do |page| page.remove "test1" @@ -454,6 +465,17 @@ class AssertSelectTest < Test::Unit::TestCase assert_select_rjs :show, "test1" end + def test_assert_select_rjs_for_show_offers_useful_error_when_assertion_fails + render_rjs do |page| + page.show "test_with_typo" + end + + assert_select_rjs :show, "test1" + + rescue Test::Unit::AssertionFailedError + assert_equal "No RJS statement that shows 'test1' was rendered.", $!.message + end + def test_assert_select_rjs_for_show_ignores_block render_rjs do |page| page.show "test1" @@ -475,6 +497,17 @@ class AssertSelectTest < Test::Unit::TestCase assert_select_rjs :hide, "test1" end + def test_assert_select_rjs_for_hide_offers_useful_error_when_assertion_fails + render_rjs do |page| + page.hide "test_with_typo" + end + + assert_select_rjs :hide, "test1" + + rescue Test::Unit::AssertionFailedError + assert_equal "No RJS statement that hides 'test1' was rendered.", $!.message + end + def test_assert_select_rjs_for_hide_ignores_block render_rjs do |page| page.hide "test1" @@ -496,6 +529,17 @@ class AssertSelectTest < Test::Unit::TestCase assert_select_rjs :toggle, "test1" end + def test_assert_select_rjs_for_toggle_offers_useful_error_when_assertion_fails + render_rjs do |page| + page.toggle "test_with_typo" + end + + assert_select_rjs :toggle, "test1" + + rescue Test::Unit::AssertionFailedError + assert_equal "No RJS statement that toggles 'test1' was rendered.", $!.message + end + def test_assert_select_rjs_for_toggle_ignores_block render_rjs do |page| page.toggle "test1" |