Skip to content

Commit

Permalink
Do not calling AWS.stub! right away, it's leaking to S3LiveTest
Browse files Browse the repository at this point in the history
  • Loading branch information
sikachu committed Dec 12, 2011
1 parent 128d664 commit 81129ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 0 additions & 4 deletions test/storage/s3_live_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ class S3LiveTest < Test::Unit::TestCase
@dummy.save
end

teardown { @dummy.destroy }

should "return an unescaped version for path" do
assert_match /.+\/spaced file\.png/, @dummy.avatar.path
end
Expand Down Expand Up @@ -114,8 +112,6 @@ class S3LiveTest < Test::Unit::TestCase
@dummy.save
end

teardown { @dummy.destroy }

should "return an unescaped version for path" do
assert_match /.+\/question\?mark\.png/, @dummy.avatar.path
end
Expand Down
11 changes: 8 additions & 3 deletions test/storage/s3_test.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
require './test/helper'
require 'aws'

AWS.stub!
AWS.config(:access_key_id => "TESTKEY", :secret_access_key => "TESTSECRET")

class S3Test < Test::Unit::TestCase
def rails_env(env)
silence_warnings do
Object.const_set(:Rails, stub('Rails', :env => env))
end
end

def setup
AWS.config(:access_key_id => "TESTKEY", :secret_access_key => "TESTSECRET", :stub_requests => true)
end

def teardown
AWS.config(:access_key_id => nil, :secret_access_key => nil, :stub_requests => nil)
end

context "Parsing S3 credentials" do
setup do
@proxy_settings = {:host => "127.0.0.1", :port => 8888, :user => "foo", :password => "bar"}
Expand Down

0 comments on commit 81129ad

Please sign in to comment.