Sha256: c606526bc0260d8dcd75dd356db32935d03b21d55170f9b04fc5fe2c0fd62fd4

Contents?: true

Size: 934 Bytes

Versions: 6

Compression:

Stored size: 934 Bytes

Contents

require 'spec_helper'

describe Paperclip::AttachmentRegistry do
  context "for" do
    before do
      class AdapterTest
        def initialize(_target, _ = {}); end
      end
      @subject = Paperclip::AdapterRegistry.new
      @subject.register(AdapterTest){|t| Symbol === t }
    end

    it "returns the class registered for the adapted type" do
      assert_equal AdapterTest, @subject.for(:target).class
    end
  end

  context "registered?" do
    before do
      class AdapterTest
        def initialize(_target, _ = {}); end
      end
      @subject = Paperclip::AdapterRegistry.new
      @subject.register(AdapterTest){|t| Symbol === t }
    end

    it "returns true when the class of this adapter has been registered" do
      assert @subject.registered?(AdapterTest.new(:target))
    end

    it "returns false when the adapter has not been registered" do
      assert ! @subject.registered?(Object)
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
kt-paperclip-5.4.0 spec/paperclip/io_adapters/registry_spec.rb
paperclip-6.1.0 spec/paperclip/io_adapters/registry_spec.rb
paperclip-6.0.0 spec/paperclip/io_adapters/registry_spec.rb
paperclip-5.3.0 spec/paperclip/io_adapters/registry_spec.rb
paperclip-5.2.1 spec/paperclip/io_adapters/registry_spec.rb
paperclip-5.2.0 spec/paperclip/io_adapters/registry_spec.rb