Commit 81129ad1 by Prem Sichanugrist

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

parent 128d664c
...@@ -80,8 +80,6 @@ unless ENV["S3_BUCKET"].blank? ...@@ -80,8 +80,6 @@ unless ENV["S3_BUCKET"].blank?
@dummy.save @dummy.save
end end
teardown { @dummy.destroy }
should "return an unescaped version for path" do should "return an unescaped version for path" do
assert_match /.+\/spaced file\.png/, @dummy.avatar.path assert_match /.+\/spaced file\.png/, @dummy.avatar.path
end end
...@@ -114,8 +112,6 @@ unless ENV["S3_BUCKET"].blank? ...@@ -114,8 +112,6 @@ unless ENV["S3_BUCKET"].blank?
@dummy.save @dummy.save
end end
teardown { @dummy.destroy }
should "return an unescaped version for path" do should "return an unescaped version for path" do
assert_match /.+\/question\?mark\.png/, @dummy.avatar.path assert_match /.+\/question\?mark\.png/, @dummy.avatar.path
end end
......
require './test/helper' require './test/helper'
require 'aws' require 'aws'
AWS.stub!
AWS.config(:access_key_id => "TESTKEY", :secret_access_key => "TESTSECRET")
class S3Test < Test::Unit::TestCase class S3Test < Test::Unit::TestCase
def rails_env(env) def rails_env(env)
silence_warnings do silence_warnings do
...@@ -11,6 +8,14 @@ class S3Test < Test::Unit::TestCase ...@@ -11,6 +8,14 @@ class S3Test < Test::Unit::TestCase
end end
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 context "Parsing S3 credentials" do
setup do setup do
@proxy_settings = {:host => "127.0.0.1", :port => 8888, :user => "foo", :password => "bar"} @proxy_settings = {:host => "127.0.0.1", :port => 8888, :user => "foo", :password => "bar"}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment