Skip to content

Commit

Permalink
Fix assert_select_rjs not checking id for inserts [#540 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
fcheung committed Dec 26, 2008
1 parent d7b6e48 commit dce0da7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Expand Up @@ -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]})"
Expand Down
8 changes: 8 additions & 0 deletions actionpack/test/controller/assert_select_test.rb
Expand Up @@ -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.
#
Expand Down

0 comments on commit dce0da7

Please sign in to comment.