Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 81129ad11c932897c2003144e8a2c76a5c613878 1 parent 128d664
Prem Sichanugrist authored
4  test/storage/s3_live_test.rb
@@ -80,8 +80,6 @@ class S3LiveTest < Test::Unit::TestCase
80 80
         @dummy.save
81 81
       end
82 82
 
83  
-      teardown { @dummy.destroy }
84  
-
85 83
       should "return an unescaped version for path" do
86 84
         assert_match /.+\/spaced file\.png/, @dummy.avatar.path
87 85
       end
@@ -114,8 +112,6 @@ class S3LiveTest < Test::Unit::TestCase
114 112
         @dummy.save
115 113
       end
116 114
 
117  
-      teardown { @dummy.destroy }
118  
-
119 115
       should "return an unescaped version for path" do
120 116
         assert_match /.+\/question\?mark\.png/, @dummy.avatar.path
121 117
       end
11  test/storage/s3_test.rb
... ...
@@ -1,9 +1,6 @@
1 1
 require './test/helper'
2 2
 require 'aws'
3 3
 
4  
-AWS.stub!
5  
-AWS.config(:access_key_id => "TESTKEY", :secret_access_key => "TESTSECRET")
6  
-
7 4
 class S3Test < Test::Unit::TestCase
8 5
   def rails_env(env)
9 6
     silence_warnings do
@@ -11,6 +8,14 @@ def rails_env(env)
11 8
     end
12 9
   end
13 10
 
  11
+  def setup
  12
+    AWS.config(:access_key_id => "TESTKEY", :secret_access_key => "TESTSECRET", :stub_requests => true)
  13
+  end
  14
+
  15
+  def teardown
  16
+    AWS.config(:access_key_id => nil, :secret_access_key => nil, :stub_requests => nil)
  17
+  end
  18
+
14 19
   context "Parsing S3 credentials" do
15 20
     setup do
16 21
       @proxy_settings = {:host => "127.0.0.1", :port => 8888, :user => "foo", :password => "bar"}

0 notes on commit 81129ad

Please sign in to comment.
Something went wrong with that request. Please try again.