Created
April 22, 2011 01:13
-
-
Save mikegehard/935825 to your computer and use it in GitHub Desktop.
Mocking fog for use with carrierwave
This file contains 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
# drop this into a file in spec/support or feature/support and you should be all set. | |
unless Kernel.const_defined?("S3_CONFIG") | |
S3_CONFIG = YAML.load_file("#{Rails.root}/config/s3.yml")[Rails.env].try(:symbolize_keys) | |
end | |
Fog.mock! | |
connection = ::Fog::Storage.new( | |
:aws_access_key_id => S3_CONFIG[:access_key_id], | |
:aws_secret_access_key => S3_CONFIG[:secret_access_key], | |
:provider => 'AWS', | |
:region => "us-east-1" | |
) | |
connection.directories.create(:key => S3_CONFIG[:bucket]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment