Commit e64021e9 by Joshua Clayton Committed by Prem Sichanugrist

Don't define methods in shoulda contexts

parent f7284b9e
...@@ -350,7 +350,9 @@ class S3Test < Test::Unit::TestCase ...@@ -350,7 +350,9 @@ class S3Test < Test::Unit::TestCase
end end
context "Generating a secure url with an expiration" do context "Generating a secure url with an expiration" do
def build_model_with_options(options = {}) setup do
@build_model_with_options = lambda {|options|
options ||= {}
base_options = { base_options = {
:storage => :s3, :storage => :s3,
:s3_credentials => { :s3_credentials => {
...@@ -364,10 +366,11 @@ class S3Test < Test::Unit::TestCase ...@@ -364,10 +366,11 @@ class S3Test < Test::Unit::TestCase
} }
rebuild_model base_options.merge(options) rebuild_model base_options.merge(options)
}
end end
should "use default options" do should "use default options" do
build_model_with_options @build_model_with_options[{}]
rails_env("production") rails_env("production")
...@@ -382,7 +385,7 @@ class S3Test < Test::Unit::TestCase ...@@ -382,7 +385,7 @@ class S3Test < Test::Unit::TestCase
end end
should "allow overriding s3_url_options" do should "allow overriding s3_url_options" do
build_model_with_options :s3_url_options => { :response_content_disposition => "inline" } @build_model_with_options[:s3_url_options => { :response_content_disposition => "inline" }]
rails_env("production") rails_env("production")
...@@ -397,7 +400,7 @@ class S3Test < Test::Unit::TestCase ...@@ -397,7 +400,7 @@ class S3Test < Test::Unit::TestCase
end end
should "allow overriding s3_object options with a proc" do should "allow overriding s3_object options with a proc" do
build_model_with_options :s3_url_options => lambda {|attachment| { :response_content_type => attachment.avatar_content_type } } @build_model_with_options[:s3_url_options => lambda {|attachment| { :response_content_type => attachment.avatar_content_type } }]
rails_env("production") rails_env("production")
......
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