Sha256: 6d2b134c1372a79daa827009da02ffd3ca04d4e79ce177bda59aca15ad9997a7
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 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%2523/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 :dynamic_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-1.0.0a.2 | test/unit/attachment_test.rb |
dynamic_paperclip-1.0.0a.1 | test/unit/attachment_test.rb |