Created
November 13, 2012 16:23
-
-
Save cutalion/4066742 to your computer and use it in GitHub Desktop.
CarrierWave test configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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