From dce0da77e7ef602f7420f43c0d1aba5a99a00bdb Mon Sep 17 00:00:00 2001 From: Frederick Cheung Date: Thu, 25 Dec 2008 11:11:00 +0000 Subject: Fix assert_select_rjs not checking id for inserts [#540 state:resolved] --- .../lib/action_controller/assertions/selector_assertions.rb | 1 + actionpack/test/controller/assert_select_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'actionpack') 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", "
foo
" + page.insert_html :bottom, "test2", "
foo
" + end + assert_raises(Assertion) {assert_select_rjs :insert, :top, "test2"} + end + # # Test css_select. # -- cgit v1.2.3