Sha256: f07a8c1d532a859e27eaee208a452cdd32b072b5dd2dcdf78bc5bd5ae909317e

Contents?: true

Size: 972 Bytes

Versions: 4

Compression:

Stored size: 972 Bytes

Contents

require 'test_helper'

class Foo; end

class HasAttachedFileTest < Test::Unit::TestCase
  should 'glob id_partition' do
    DynamicPaperclip::HasAttachedFile.new Foo, :bar, { url: '/system/foos/bars/:id_partition/:style/:filename' }

    assert Rails.application.routes.routes.any? do |route|
      route.path.spec == '/system/foos/bars/*id_partition/:style/:filename(.:format)'
    end
  end

  should 'interpolate :class' do
    DynamicPaperclip::HasAttachedFile.new Foo, :bar, { url: '/system/:class/bars/:id/:style/:filename' }

    assert Rails.application.routes.routes.any? do |route|
      route.path.spec == '/system/foos/bars/:id/:style/:filename(.:format)'
    end
  end

  should "use Paperclip's default URL if none is specified" do
    DynamicPaperclip::HasAttachedFile.new Foo, :bar, {}

    assert Rails.application.routes.routes.any? do |route|
      route.path.spec == '/system/foos/:attachment/*id_partition/:style/:filename(.:format)'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dynamic_paperclip-0.0.4 test/unit/has_attached_file_test.rb
dynamic_paperclip-0.0.3 test/unit/has_attached_file_test.rb
dynamic_paperclip-0.0.2 test/unit/has_attached_file_test.rb
dynamic_paperclip-0.0.1 test/unit/has_attached_file_test.rb