From 36005af64a0c233e7391688296b183acb73dc0c0 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Thu, 22 Oct 2015 20:33:32 +0900 Subject: Use sufficient a regexp anchor to check `@response.content_type.to_s` This commit follows up of ea9bc06c9a47b839d5e2db94ba6bf7e29c8f0ae9. To check `@response.content_type.to_s` is ended with `"xml"`, to use `\z` is sufficient. --- actionpack/lib/action_dispatch/testing/assertions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/testing/assertions.rb b/actionpack/lib/action_dispatch/testing/assertions.rb index 715d94d406..fae266273e 100644 --- a/actionpack/lib/action_dispatch/testing/assertions.rb +++ b/actionpack/lib/action_dispatch/testing/assertions.rb @@ -12,7 +12,7 @@ module ActionDispatch include Rails::Dom::Testing::Assertions def html_document - @html_document ||= if @response.content_type.to_s =~ /xml$/ + @html_document ||= if @response.content_type.to_s =~ /xml\z/ Nokogiri::XML::Document.parse(@response.body) else Nokogiri::HTML::Document.parse(@response.body) -- cgit v1.2.3