Skip to content

Commit 0fa540c

Browse files
committed
Stop catching Nokogiri::CSS::SyntaxError
1 parent f94ac0a commit 0fa540c

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/rails/dom/testing/assertions/selector_assertions.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ def css_select(*args)
6262
root = args.size == 1 ? document_root_element : args.shift
6363

6464
nodeset(root).css(args.first)
65-
rescue Nokogiri::CSS::SyntaxError => e
66-
ActiveSupport::Deprecation.warn("The assertion was not run because of an invalid css selector.\n#{e}", caller(2))
67-
return
6865
end
6966

7067
# An assertion that selects elements and makes one or more equality tests.
@@ -177,9 +174,6 @@ def assert_select(*args, &block)
177174

178175
nest_selection(matches, &block) if block_given? && !matches.empty?
179176
end
180-
rescue Nokogiri::CSS::SyntaxError => e
181-
ActiveSupport::Deprecation.warn("The assertion was not run because of an invalid css selector.\n#{e}", caller(2))
182-
return
183177
end
184178

185179
# Extracts the content of an element, treats it as encoded HTML and runs

test/selector_assertions_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,15 @@ def test_nested_css_select
220220
# testing invalid selectors
221221
def test_assert_select_with_invalid_selector
222222
render_html '<a href="http://example.com">hello</a>'
223-
assert_deprecated do
224-
assert_nil assert_select("[href=http://example.com]")
223+
assert_raises Nokogiri::CSS::SyntaxError do
224+
assert_select("[href=http://example.com]")
225225
end
226226
end
227227

228228
def test_css_select_with_invalid_selector
229229
render_html '<a href="http://example.com">hello</a>'
230-
assert_deprecated do
231-
assert_nil css_select("[href=http://example.com]")
230+
assert_raises Nokogiri::CSS::SyntaxError do
231+
css_select("[href=http://example.com]")
232232
end
233233
end
234234

0 commit comments

Comments
 (0)