Skip to content

Commit bc87e21

Browse files
committed
String#end_with? should be faster than Regexp here
1 parent 24bacb3 commit bc87e21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

actionpack/lib/action_dispatch/testing/assertions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Assertions
1212
include Rails::Dom::Testing::Assertions
1313

1414
def html_document
15-
@html_document ||= if @response.content_type.to_s =~ /xml\z/
15+
@html_document ||= if @response.content_type.to_s.end_with?("xml")
1616
Nokogiri::XML::Document.parse(@response.body)
1717
else
1818
Nokogiri::HTML::Document.parse(@response.body)

0 commit comments

Comments
 (0)