1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #22029 from yui-knk/fixup_content_type_regexp

Use sufficient a regexp anchor to check `@response.content_type.to_s`
This commit is contained in:
Rafael Mendonça França 2015-10-22 13:51:54 -02:00
commit 2828cfd137

View file

@ -12,7 +12,7 @@ module ActionDispatch
include Rails::Dom::Testing::Assertions include Rails::Dom::Testing::Assertions
def html_document 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) Nokogiri::XML::Document.parse(@response.body)
else else
Nokogiri::HTML::Document.parse(@response.body) Nokogiri::HTML::Document.parse(@response.body)