Sha256: acee7577f5769bc5fef459cff2256bbf1a09896ea797306b982bfb264b67c4b3

Contents?: true

Size: 929 Bytes

Versions: 23

Compression:

Stored size: 929 Bytes

Contents

require './test/helper'

class AdapterRegistryTest < Test::Unit::TestCase
  context "for" do
    setup do
      class AdapterTest
        def initialize(target); end
      end
      @subject = Paperclip::AdapterRegistry.new
      @subject.register(AdapterTest){|t| Symbol === t }
    end
    should "return the class registered for the adapted type" do
      assert_equal AdapterTest, @subject.for(:target).class
    end
  end

  context "registered?" do
    setup do
      class AdapterTest
        def initialize(target); end
      end
      @subject = Paperclip::AdapterRegistry.new
      @subject.register(AdapterTest){|t| Symbol === t }
    end
    should "return true when the class of this adapter has been registered" do
      assert @subject.registered?(AdapterTest.new(:target))
    end
    should "return false when the adapter has not been registered" do
      assert ! @subject.registered?(Object)
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
paperclip-4.1.1 test/io_adapters/registry_test.rb
paperclip-4.1.0 test/io_adapters/registry_test.rb
paperclip-3.5.4 test/io_adapters/registry_test.rb
paperclip-4.0.0 test/io_adapters/registry_test.rb
paperclip-3.5.3 test/io_adapters/registry_test.rb
paperclip-3.5.2 test/io_adapters/registry_test.rb
paperclip-3.5.1 test/io_adapters/registry_test.rb
paperclip-3.5.0 test/io_adapters/registry_test.rb
paperclip-3.4.2 test/io_adapters/registry_test.rb
paperclip-3.4.1 test/io_adapters/registry_test.rb
paperclip-3.4.0 test/io_adapters/registry_test.rb
paperclip-3.3.1 test/io_adapters/registry_test.rb
paperclip-3.2.1 test/io_adapters/registry_test.rb
paperclip-3.3.0 test/io_adapters/registry_test.rb
paperclip-3.2.0 test/io_adapters/registry_test.rb
paperclip-3.1.4 test/io_adapters/registry_test.rb
paperclip-3.1.2 test/io_adapters/registry_test.rb
paperclip-3.1.1 test/io_adapters/registry_test.rb
paperclip-3.1.0 test/io_adapters/registry_test.rb
paperclip-3.0.4 test/io_adapters/registry_test.rb