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

Sort the mime types before comparing

For those tests that use start we don't need to assert the actual order
of mime types that are returned.

This happen because this order is more about the order the mime type was
registered than the order that it is expected to it resolve.

We need to sort because we remove the json mime type in
json_params_parsing_test and add it to the end of the mime types set so
if that file runs before those tests we will have a failing test.

[Rafael Mendonça França + Lucas Hosseini]
This commit is contained in:
Rafael Mendonça França 2016-07-12 01:58:29 -03:00
parent 245eb34f2b
commit 6bdec0f4c2
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948

View file

@ -44,14 +44,14 @@ class MimeTypeTest < ActiveSupport::TestCase
accept = "text/*"
expect = [Mime[:html], Mime[:text], Mime[:js], Mime[:css], Mime[:ics], Mime[:csv], Mime[:vcf], Mime[:xml], Mime[:yaml], Mime[:json]]
parsed = Mime::Type.parse(accept)
assert_equal expect, parsed
assert_equal expect.map(&:to_s).sort!, parsed.map(&:to_s).sort!
end
test "parse application with trailing star" do
accept = "application/*"
expect = [Mime[:html], Mime[:js], Mime[:xml], Mime[:rss], Mime[:atom], Mime[:yaml], Mime[:url_encoded_form], Mime[:json], Mime[:pdf], Mime[:zip], Mime[:gzip]]
parsed = Mime::Type.parse(accept)
assert_equal expect, parsed
assert_equal expect.map(&:to_s).sort!, parsed.map(&:to_s).sort!
end
test "parse without q" do