diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-07-12 01:58:29 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-07-17 05:13:20 -0300 |
commit | 6bdec0f4c2d4894da6628abb6151575ece282516 (patch) | |
tree | 8aa0d242ef3613ce584d8650e27c665ff1e09277 | |
parent | 245eb34f2b17d94c90f2a2a1459744a99a567034 (diff) | |
download | rails-6bdec0f4c2d4894da6628abb6151575ece282516.tar.gz rails-6bdec0f4c2d4894da6628abb6151575ece282516.tar.bz2 rails-6bdec0f4c2d4894da6628abb6151575ece282516.zip |
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]
-rw-r--r-- | actionpack/test/dispatch/mime_type_test.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/test/dispatch/mime_type_test.rb b/actionpack/test/dispatch/mime_type_test.rb index 672b272590..e1d19c3520 100644 --- a/actionpack/test/dispatch/mime_type_test.rb +++ b/actionpack/test/dispatch/mime_type_test.rb @@ -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 |