diff options
-rw-r--r-- | actionview/lib/action_view/testing/assertions/selector.rb | 7 | ||||
-rw-r--r-- | actionview/test/template/assert_select_test.rb | 8 |
2 files changed, 10 insertions, 5 deletions
diff --git a/actionview/lib/action_view/testing/assertions/selector.rb b/actionview/lib/action_view/testing/assertions/selector.rb index aac5a82e81..58f3f329b1 100644 --- a/actionview/lib/action_view/testing/assertions/selector.rb +++ b/actionview/lib/action_view/testing/assertions/selector.rb @@ -29,7 +29,7 @@ module ActionView # 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 @@ module ActionView # 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 @@ module ActionView 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 diff --git a/actionview/test/template/assert_select_test.rb b/actionview/test/template/assert_select_test.rb index af1ddb5c12..e53b9635e5 100644 --- a/actionview/test/template/assert_select_test.rb +++ b/actionview/test/template/assert_select_test.rb @@ -269,12 +269,16 @@ class AssertSelectTest < ActionController::TestCase # 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 |