Skip to content

Instantly share code, notes, and snippets.

@cutalion
Created November 13, 2012 16:23
Show Gist options
  • Save cutalion/4066742 to your computer and use it in GitHub Desktop.
Save cutalion/4066742 to your computer and use it in GitHub Desktop.
CarrierWave test configuration
# spec/support/carrierwave.rb
class TestStorage < CarrierWave::Storage::File
def store!(file)
end
def retrieve!(identifier)
identifier
end
end
if Rails.env.test? or Rails.env.cucumber?
CarrierWave.configure do |config|
config.storage_engines[:test] = "TestStorage"
config.storage = :test
config.enable_processing = false
end
end
RSpec.configure do |config|
config.around(:each, :file_storage => true) do |example|
CarrierWave.configure { |c| c.storage = :file }
example.run
CarrierWave.configure { |c| c.storage = :test }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment