diff options
author | yui-knk <spiketeika@gmail.com> | 2015-10-22 20:33:32 +0900 |
---|---|---|
committer | yui-knk <spiketeika@gmail.com> | 2015-10-22 20:33:32 +0900 |
commit | 36005af64a0c233e7391688296b183acb73dc0c0 (patch) | |
tree | 67c32c241f2f25f7f0a7dfa4f20a50d6c1cfb74d /actionpack/lib/action_dispatch/testing | |
parent | 3eda77f0eeeb479355b8845aa71cb0da1acd583d (diff) | |
download | rails-36005af64a0c233e7391688296b183acb73dc0c0.tar.gz rails-36005af64a0c233e7391688296b183acb73dc0c0.tar.bz2 rails-36005af64a0c233e7391688296b183acb73dc0c0.zip |
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.
Diffstat (limited to 'actionpack/lib/action_dispatch/testing')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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) |