summaryrefslogtreecommitdiff
path: root/test/test_mime_types_loader.rb
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2021-06-02 10:42:23 -0400
committerGitHub <noreply@github.com>2021-06-02 10:42:23 -0400
commit6c8324d2396e7698296bbecf376a4a647b258057 (patch)
tree8310377885377e1f44526f69c8588c759b3aa215 /test/test_mime_types_loader.rb
parentb8db65ac00b8f23d4274ed47aada475a65cc24d0 (diff)
downloadmime-types-6c8324d2396e7698296bbecf376a4a647b258057.tar.gz
Convert to standardrb (#156)
- I mostly don’t care about this, but there are a couple of things that Standard does that I disagree with. They are inherited from Rubocop, but Standard fixes many of Rubocop’s nonsense rules. - Array literal wrappers %i[], %w[], etc. are just ugly and never should have become any sort of standard. I would be happier if this part of standard were just completely disabled, because it‘s unnecessary and wrong. - Quote literals having to be %q() is equally wrong. I’ve avoided the issue here because the generated gemspec uses both "unnecessary" quote literals (it’s necessary if I say it’s necessary) and the wrong wrappers (I wouldn’t use %q<>, but this is generated code). - I still think that short hashes can be `{ foo: "bar" }`, but I’m mostly using Elixir these days, so I don’t mind `%{foo: "bar"}`, so I can get used to it in Ruby. It still feels wrong, almost 20 years in. - There are semantic differences between and / &&, or / ||, but in some cases the reformatted code is substantially _worse_ to read. Again, I mostly don’t _care_ about this difference, but Rubocop’s insistence is silly; these should only be replaced where there _is_ ambiguity. - Replacing `x = foo or next` should never be replaced with `(x = foo) || next`. That’s replacing something that is somewhat readable with something damned-near unreadable. Both should be replaced with: ```ruby x = foo next unless x ``` - YAML.safe_load works differently between Psych 2.x and Psych 3.x, so some updates have been made to make that work cleanly. Overall, this introduces a lot of churn, but I think will be easier to deal with updates to `standardrb` instead of the rapid churn that has been Rubocop.
Diffstat (limited to 'test/test_mime_types_loader.rb')
-rw-r--r--test/test_mime_types_loader.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/test_mime_types_loader.rb b/test/test_mime_types_loader.rb
index 7fb4e9b..af5d851 100644
--- a/test/test_mime_types_loader.rb
+++ b/test/test_mime_types_loader.rb
@@ -1,32 +1,32 @@
# frozen_string_literal: true
-require 'mime/types'
-require 'minitest_helper'
+require "mime/types"
+require "minitest_helper"
describe MIME::Types::Loader do
def setup
- @path = File.expand_path('../fixture', __FILE__)
- @loader = MIME::Types::Loader.new(@path)
- @bad_path = File.expand_path('../bad-fixtures', __FILE__)
+ @path = File.expand_path("../fixture", __FILE__)
+ @loader = MIME::Types::Loader.new(@path)
+ @bad_path = File.expand_path("../bad-fixtures", __FILE__)
end
def assert_correctly_loaded(types)
- assert_includes(types, 'application/1d-interleaved-parityfec')
- assert_equal(%w(webm), types['audio/webm'].first.extensions)
- refute(types['audio/webm'].first.registered?)
+ assert_includes(types, "application/1d-interleaved-parityfec")
+ assert_equal(%w[webm], types["audio/webm"].first.extensions)
+ refute(types["audio/webm"].first.registered?)
- assert_equal('Fixes a bug with IE6 and progressive JPEGs',
- types['image/pjpeg'].first.docs)
+ assert_equal("Fixes a bug with IE6 and progressive JPEGs",
+ types["image/pjpeg"].first.docs)
- assert(types['audio/vnd.qcelp'].first.obsolete?)
- assert_equal('audio/QCELP', types['audio/vnd.qcelp'].first.use_instead)
+ assert(types["audio/vnd.qcelp"].first.obsolete?)
+ assert_equal("audio/QCELP", types["audio/vnd.qcelp"].first.use_instead)
end
- it 'loads YAML files correctly' do
+ it "loads YAML files correctly" do
assert_correctly_loaded @loader.load_yaml
end
- it 'loads JSON files correctly' do
+ it "loads JSON files correctly" do
assert_correctly_loaded @loader.load_json
end
end