Sha256: 20fa273a835dbc6884bffe37a01bc5c4419acaa836328188382678de05ef1e71
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
require './test/helper' require 'aws/s3' unless ENV["S3_TEST_BUCKET"].blank? class S3LiveTest < Test::Unit::TestCase context "Using S3 for real, an attachment with S3 storage" do setup do rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" }, :storage => :s3, :bucket => ENV["S3_TEST_BUCKET"], :path => ":class/:attachment/:id/:style.:extension", :s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "s3.yml")) Dummy.delete_all @dummy = Dummy.new end should "be extended by the S3 module" do assert Dummy.new.avatar.is_a?(Paperclip::Storage::S3) end context "when assigned" do setup do @file = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', '5k.png'), 'rb') @dummy.avatar = @file end teardown { @file.close } should "still return a Tempfile when sent #to_file" do assert_equal Paperclip::Tempfile, @dummy.avatar.to_file.class end context "and saved" do setup do @dummy.save end should "be on S3" do assert true end should "generate a tempfile with the right name" do file = @dummy.avatar.to_file assert_match /^original.*\.png$/, File.basename(file.path) end end end end end end
Version data entries
4 entries across 4 versions & 2 rubygems