Created
June 4, 2012 21:13
-
-
Save brycemcd/2870882 to your computer and use it in GitHub Desktop.
problem with interface between s3, vcr and paperclip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) MasterAsset validations after_create should fill in sha with the SHA1 of the file and the url with the url | |
Failure/Error: mi.image = img | |
AWS::Errors::Base: | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/aws-sdk-1.3.3/lib/aws/core/client.rb:261:in `return_or_raise' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/aws-sdk-1.3.3/lib/aws/core/client.rb:323:in `client_request' | |
# (eval):3:in `head_object' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/aws-sdk-1.3.3/lib/aws/s3/s3_object.rb:94:in `head' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/aws-sdk-1.3.3/lib/aws/s3/s3_object.rb:71:in `exists?' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/paperclip-2.5.2/lib/paperclip/storage/s3.rb:237:in `exists?' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/paperclip-2.5.2/lib/paperclip/attachment.rb:460:in `block in queue_existing_for_delete' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/paperclip-2.5.2/lib/paperclip/attachment.rb:459:in `map' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/paperclip-2.5.2/lib/paperclip/attachment.rb:459:in `queue_existing_for_delete' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/paperclip-2.5.2/lib/paperclip/attachment.rb:223:in `clear' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/paperclip-2.5.2/lib/paperclip/attachment.rb:105:in `assign' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/paperclip-2.5.2/lib/paperclip.rb:344:in `block in has_attached_file' | |
# ./spec/models/master_asset_spec.rb:15:in `block (5 levels) in <top (required)>' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/vcr-2.1.1/lib/vcr/util/variable_args_block_caller.rb:9:in `call' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/vcr-2.1.1/lib/vcr/util/variable_args_block_caller.rb:9:in `call_block' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/vcr-2.1.1/lib/vcr.rb:159:in `use_cassette' | |
# ./spec/spec_helper.rb:85:in `use_cassette' | |
# ./spec/models/master_asset_spec.rb:12:in `block (4 levels) in <top (required)>' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in `instance_eval' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in `block in run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:173:in `with_around_hooks' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:77:in `run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:355:in `block in run_examples' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:351:in `map' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:351:in `run_examples' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:337:in `run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:338:in `block in run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:338:in `map' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:338:in `run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:338:in `block in run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:338:in `map' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:338:in `run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:28:in `map' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:28:in `block in run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:34:in `report' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:25:in `run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run' | |
# /usr/local/rvm/gems/ruby-1.9.3-p125@theclymb3/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
has_attached_file :image, :styles => { :grid => "324x486>", | |
:detail => "480x720>", | |
:detail_many => "400x600>", | |
:thumb => "75x100#", | |
:detail_alt => "100x170#", | |
:seo => "184x276>"}, | |
:default_url => "/images/missing.png", | |
:storage => :s3, | |
:s3_credentials => AWSHelper.s3_credentials, | |
:bucket => APP_CONFIG['cdn_bucket'], | |
:s3_host_alias => APP_CONFIG['cdn_product_images_host'], | |
:url => ':s3_alias_url', | |
:path => "brands/:brand_title/:master_asset_path/:tag-:short_sha-:style.:super_extension" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "should fill in sha and url" do | |
VCR.use_cassette("master_image_create_2", :match_requests_on => [:method, :uri]) do | |
mi = Factory.build(:master_asset) # very basic model, no image added yet | |
img = File.new( File.join(Rails.root, "spec", "support", "fonzi.jpg") ) | |
mi.image = img | |
mi.valid? | |
mi.sha.should eql("f70393ee4d6e1f6a735df9526694e038371e5b3c") | |
mi.url.to_s.include?("http://domain.com/test-brand/original-test-product_f_test-color-1_test-color-2_test-color-3.jpg").should be_true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment