Sha256: 50c9bb16ebed354a6dd5052a8ddd4b766678eebff7fb8b3393ce7e7b915be994
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
require 'test_helper' class AttachmentTest < ActiveSupport::TestCase fixtures :photos should 'use DynamicPaperclip::Attachment for dynamic attachments' do assert Photo.new.image.is_a?(DynamicPaperclip::Attachment) end should 'generate correct secure attachment URL when given a style definition' do DynamicPaperclip::Config.any_instance.stubs(:secret).returns('abc123') assert_equal "/system/photos/images/000/000/001/dynamic_50x50%23/rails.png?s=#{Digest::SHA1.hexdigest("abc123dynamic_50x50%23")}", photos(:rails).image.dynamic_url('50x50#') end should 'raise error if no secret has been configured' do DynamicPaperclip::Config.any_instance.stubs(:secret).returns(nil) assert_raises(DynamicPaperclip::Errors::SecretNotSet) { photos(:rails).image.dynamic_url('50x50#') } end should 'include existing dynamic styles in #styles' do assert photos(:rails).image.styles.has_key?(:thumb) assert photos(:rails).image.styles.has_key?(:dynamic_42x42) end should 'only include dynamic styles in #dynamic_styles' do assert photos(:rails).image.dynamic_styles.has_key?(:dynamic_42x42) assert !photos(:rails).image.dynamic_styles.has_key?(:thumb) end should 'add dynamic style to #styles and reprocess it when a dynamic style name is passed to #process_dynamic_style' do attachment = photos(:rails).image attachment.expects(:reprocess!).with(:dynamic_42x42).once attachment.process_dynamic_style '42x42' assert_equal '42x42', attachment.styles[:dynamic_42x42].geometry end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dynamic_paperclip-0.0.4 | test/unit/attachment_test.rb |
dynamic_paperclip-0.0.3 | test/unit/attachment_test.rb |