提交 68e08fe8 编写于 作者: T Timm

Silenced deprecation warnings in the tests. Documentation uses present tense....

Silenced deprecation warnings in the tests. Documentation uses present tense. Changed deprecation message to not use you. Also returning from rescue block in catch_invalid_selector to abort reraising the exception.
上级 9ef95a70
......@@ -29,7 +29,7 @@ module SelectorAssertions
# Returns an empty Nokogiri::XML::NodeSet if no match is found.
#
# The selector may be a CSS selector expression (String).
# css_select will return nil if called with an invalid css selector.
# css_select returns nil if called with an invalid css selector.
#
# # Selects all div tags
# divs = css_select("div")
......@@ -96,7 +96,7 @@ def css_select(*args)
# The selector may be a CSS selector expression (String) or an expression
# with substitution values (Array).
# Substitution uses a custom pseudo class match. Pass in whatever attribute you want to match (enclosed in quotes) and a ? for the substitution.
# assert_select will return nil if called with an invalid css selector.
# assert_select returns nil if called with an invalid css selector.
#
# assert_select "div:match('id', ?)", /\d+/
#
......@@ -293,7 +293,8 @@ def catch_invalid_selector
begin
yield
rescue Nokogiri::CSS::SyntaxError => e
ActiveSupport::Deprecation.warn("You are using an invalid CSS selector and the assertion was not run. Please review it.\n#{e}")
ActiveSupport::Deprecation.warn("The assertion was not run because of an invalid css selector.\n#{e}")
return
end
end
......
......@@ -269,12 +269,16 @@ def test_nested_css_select
# testing invalid selectors
def test_assert_select_with_invalid_selector
render_html '<a href="http://example.com">hello</a>'
assert_nil assert_select("[href=http://example.com]")
ActiveSupport::Deprecation.silence do
assert_nil assert_select("[href=http://example.com]")
end
end
def test_css_select_with_invalid_selector
render_html '<a href="http://example.com">hello</a>'
assert_nil css_select("[href=http://example.com]")
ActiveSupport::Deprecation.silence do
assert_nil css_select("[href=http://example.com]")
end
end
def test_feed_item_encoded
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册