lib/rspeckled/plugins/carrier_wave.rb in rspeckled-0.0.54 vs lib/rspeckled/plugins/carrier_wave.rb in rspeckled-0.0.55
- old
+ new
@@ -1,36 +1,28 @@
# frozen_string_literal: true
-##############################################################################
-# CarrierWave Plugin
-##############################################################################
+require 'carrierwave/test/matchers'
-begin
- require 'carrierwave'
- require 'carrierwave/test/matchers'
+RSpec.configure do |config|
+ config.include CarrierWave::Test::Matchers, :file_attachment => true
+end
- RSpec.configure do |config|
- config.include CarrierWave::Test::Matchers, :file_attachment => true
- end
+CarrierWave.configure do |config|
+ config.storage = :file
+ config.root = File.expand_path('./tmp')
+ config.enable_processing = false
+end
- CarrierWave.configure do |config|
- config.storage = :file
- config.root = File.expand_path('./tmp')
- config.enable_processing = false
- end
+RSpec.configure do |config|
+ config.around(:each, :file_attachment => true) do |example|
+ previous_carrierwave_processing_mode = subject.class.enable_processing
+ previous_carrierwave_storage_mode = subject.class.storage
- RSpec.configure do |config|
- config.around(:each, :file_attachment => true) do |example|
- previous_carrierwave_processing_mode = subject.class.enable_processing
- previous_carrierwave_storage_mode = subject.class.storage
+ subject.class.enable_processing = true
+ subject.class.storage = :file
- subject.class.enable_processing = true
- subject.class.storage = :file
+ example.run
- example.run
-
- subject.class.storage = previous_carrierwave_storage_mode
- subject.class.enable_processing = previous_carrierwave_processing_mode
- end
+ subject.class.storage = previous_carrierwave_storage_mode
+ subject.class.enable_processing = previous_carrierwave_processing_mode
end
-rescue LoadError
end