Permalink
Browse files

Do not calling `AWS.stub!` right away, it's leaking to S3LiveTest

  • Loading branch information...
1 parent 128d664 commit 81129ad11c932897c2003144e8a2c76a5c613878 @sikachu sikachu committed Dec 12, 2011
Showing with 8 additions and 7 deletions.
  1. +0 −4 test/storage/s3_live_test.rb
  2. +8 −3 test/storage/s3_test.rb
@@ -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
@@ -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
@@ -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"}

0 comments on commit 81129ad

Please sign in to comment.