forked from thoughtbot/paperclip
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
S3 features passing and basic attempt to separate s3-implementation-s…
…pecific methods
- Loading branch information
Jon Yurek
committed
Jul 29, 2010
1 parent
85c65d3
commit b8aee5f
Showing
4 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Given /I validate my S3 credentials/ do | ||
key = ENV['AWS_ACCESS_KEY_ID'] | ||
secret = ENV['AWS_SECRET_ACCESS_KEY'] | ||
|
||
key.should_not be_nil | ||
secret.should_not be_nil | ||
|
||
assert_credentials(key, secret) | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module AWSS3Methods | ||
def load_s3 | ||
begin | ||
require 'aws/s3' | ||
rescue LoadError => e | ||
fail "You do not have aws-s3 installed." | ||
end | ||
end | ||
|
||
def assert_credentials(key, secret) | ||
load_s3 | ||
begin | ||
AWS::S3::Base.establish_connection!( | ||
:access_key_id => key, | ||
:secret_access_key => secret | ||
) | ||
AWS::S3::Service.buckets | ||
rescue AWS::S3::ResponseError => e | ||
fail "Could not connect using AWS credentials in AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. " + | ||
"Please make sure these are set in your environment." | ||
end | ||
end | ||
end | ||
|
||
World(AWSS3Methods) |
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