Skip to content
Browse files

Fix assert_select_rjs not checking id for inserts [#540 state:resolved]

  • Loading branch information...
1 parent d7b6e48 commit dce0da77e7ef602f7420f43c0d1aba5a99a00bdb @fcheung fcheung committed Dec 25, 2008
View
1 actionpack/lib/action_controller/assertions/selector_assertions.rb
@@ -402,6 +402,7 @@ def assert_select_rjs(*args, &block)
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]})"
View
8 actionpack/test/controller/assert_select_test.rb
@@ -248,6 +248,14 @@ def test_assert_select_from_rjs_with_multiple_results
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.
#

0 comments on commit dce0da7

Please sign in to comment.
Something went wrong with that request. Please try again.