diff options
author | Akira Matsuda <ronnie@dio.jp> | 2017-01-04 21:42:12 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2017-01-05 01:37:36 +0900 |
commit | bc87e2123df65222761dc5ae063ad7234b5d95f5 (patch) | |
tree | f4fe80e992ca753d9766e99f7d7485f27cbb0712 /actionpack | |
parent | 24bacb3e956e36414847cb250bbd6c6d9c6cadd7 (diff) | |
download | rails-bc87e2123df65222761dc5ae063ad7234b5d95f5.tar.gz rails-bc87e2123df65222761dc5ae063ad7234b5d95f5.tar.bz2 rails-bc87e2123df65222761dc5ae063ad7234b5d95f5.zip |
String#end_with? should be faster than Regexp here
Diffstat (limited to 'actionpack')
-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 b362931ef7..4ea18d671d 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\z/ + @html_document ||= if @response.content_type.to_s.end_with?("xml") Nokogiri::XML::Document.parse(@response.body) else Nokogiri::HTML::Document.parse(@response.body) |