Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't define methods in shoulda contexts

  • Loading branch information...
commit e64021e9755303ff7dc7d45ac908e65784a55e89 1 parent f7284b9
@joshuaclayton joshuaclayton authored sikachu committed
Showing with 19 additions and 16 deletions.
  1. +19 −16 test/storage/s3_test.rb
View
35 test/storage/s3_test.rb
@@ -350,24 +350,27 @@ def counter
end
context "Generating a secure url with an expiration" do
- def build_model_with_options(options = {})
- base_options = {
- :storage => :s3,
- :s3_credentials => {
- :production => { :bucket => "prod_bucket" },
- :development => { :bucket => "dev_bucket" }
- },
- :s3_host_alias => "something.something.com",
- :s3_permissions => "private",
- :path => ":attachment/:basename.:extension",
- :url => ":s3_alias_url"
- }
+ setup do
+ @build_model_with_options = lambda {|options|
+ options ||= {}
+ base_options = {
+ :storage => :s3,
+ :s3_credentials => {
+ :production => { :bucket => "prod_bucket" },
+ :development => { :bucket => "dev_bucket" }
+ },
+ :s3_host_alias => "something.something.com",
+ :s3_permissions => "private",
+ :path => ":attachment/:basename.:extension",
+ :url => ":s3_alias_url"
+ }
- rebuild_model base_options.merge(options)
+ rebuild_model base_options.merge(options)
+ }
end
should "use default options" do
- build_model_with_options
+ @build_model_with_options[{}]
rails_env("production")
@@ -382,7 +385,7 @@ def build_model_with_options(options = {})
end
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")
@@ -397,7 +400,7 @@ def build_model_with_options(options = {})
end
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")
Please sign in to comment.
Something went wrong with that request. Please try again.