diff options
author | Frederick Cheung <frederick.cheung@gmail.com> | 2008-12-25 11:11:00 +0000 |
---|---|---|
committer | Frederick Cheung <frederick.cheung@gmail.com> | 2008-12-26 18:25:32 +0000 |
commit | dce0da77e7ef602f7420f43c0d1aba5a99a00bdb (patch) | |
tree | d917bf9cd17da1575ea6ad3c97c8311ddc3ad2a6 | |
parent | d7b6e48c70076a7760e22c381e48834ecddfa6e3 (diff) | |
download | rails-dce0da77e7ef602f7420f43c0d1aba5a99a00bdb.tar.gz rails-dce0da77e7ef602f7420f43c0d1aba5a99a00bdb.tar.bz2 rails-dce0da77e7ef602f7420f43c0d1aba5a99a00bdb.zip |
Fix assert_select_rjs not checking id for inserts [#540 state:resolved]
-rw-r--r-- | actionpack/lib/action_controller/assertions/selector_assertions.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/assert_select_test.rb | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/assertions/selector_assertions.rb b/actionpack/lib/action_controller/assertions/selector_assertions.rb index 248ca85994..7f8fe9ab19 100644 --- a/actionpack/lib/action_controller/assertions/selector_assertions.rb +++ b/actionpack/lib/action_controller/assertions/selector_assertions.rb @@ -402,6 +402,7 @@ module ActionController if rjs_type if rjs_type == :insert position = args.shift + id = args.shift insertion = "insert_#{position}".to_sym raise ArgumentError, "Unknown RJS insertion type #{position}" unless RJS_STATEMENTS[insertion] statement = "(#{RJS_STATEMENTS[insertion]})" diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb index ed8c4427c9..99c57c0c91 100644 --- a/actionpack/test/controller/assert_select_test.rb +++ b/actionpack/test/controller/assert_select_test.rb @@ -248,6 +248,14 @@ class AssertSelectTest < ActionController::TestCase end end + def test_assert_select_rjs_for_positioned_insert_should_fail_when_mixing_arguments + render_rjs do |page| + page.insert_html :top, "test1", "<div id=\"1\">foo</div>" + page.insert_html :bottom, "test2", "<div id=\"2\">foo</div>" + end + assert_raises(Assertion) {assert_select_rjs :insert, :top, "test2"} + end + # # Test css_select. # |