Skip to content

Commit

Permalink
* Avoid warning messages when running spec
Browse files Browse the repository at this point in the history
Remove existing MIME constant before requiring mime-types gem
  • Loading branch information
PikachuEXE committed Dec 21, 2016
1 parent ebc053f commit 385364c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions spec/unit/storage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ def check_file(file)
before(:each) do
# Object#remove_const does not remove the loaded
# file from the $" variable
#Object.send(:remove_const, :MIME) if defined?(MIME)
#
# So we need do both
#
# 1. Remove constant(s) to avoid warning messages
# 2. Remove loaded file(s)
Object.send(:remove_const, :MIME) if defined?(MIME)
mime_types = $".grep(/mime\/types/).first
$".delete(mime_types)
require 'mime/types'
Expand Down Expand Up @@ -204,9 +209,5 @@ def check_file(file)
end
storage.upload_file('assets/some_longer_path/local_image2.jpg')
end

after(:each) do
#Object.send(:remove_const, :MIME) if defined?(MIME)
end
end
end

0 comments on commit 385364c

Please sign in to comment.