spec/paperclip/attachment_registry_spec.rb in kt-paperclip-5.4.0 vs spec/paperclip/attachment_registry_spec.rb in kt-paperclip-6.2.0

- old
+ new

@@ -1,36 +1,36 @@ -require 'spec_helper' +require "spec_helper" -describe 'Attachment Registry' do +describe "Attachment Registry" do before do Paperclip::AttachmentRegistry.clear end - context '.names_for' do - it 'includes attachment names for the given class' do + context ".names_for" do + it "includes attachment names for the given class" do foo = Class.new Paperclip::AttachmentRegistry.register(foo, :avatar, {}) assert_equal [:avatar], Paperclip::AttachmentRegistry.names_for(foo) end - it 'does not include attachment names for other classes' do + it "does not include attachment names for other classes" do foo = Class.new bar = Class.new Paperclip::AttachmentRegistry.register(foo, :avatar, {}) Paperclip::AttachmentRegistry.register(bar, :lover, {}) assert_equal [:lover], Paperclip::AttachmentRegistry.names_for(bar) end - it 'produces the empty array for a missing key' do + it "produces the empty array for a missing key" do assert_empty Paperclip::AttachmentRegistry.names_for(Class.new) end end - context '.each_definition' do - it 'calls the block with the class, attachment name, and options' do + context ".each_definition" do + it "calls the block with the class, attachment name, and options" do foo = Class.new expected_accumulations = [ [foo, :avatar, { yo: "greeting" }], [foo, :greeter, { ciao: "greeting" }] ] @@ -45,12 +45,12 @@ assert_equal expected_accumulations, accumulations end end - context '.definitions_for' do - it 'produces the attachment name and options' do + context ".definitions_for" do + it "produces the attachment name and options" do expected_definitions = { avatar: { yo: "greeting" }, greeter: { ciao: "greeting" } } foo = Class.new @@ -68,11 +68,11 @@ definitions = Paperclip::AttachmentRegistry.definitions_for(foo) assert_equal expected_definitions, definitions end - it 'produces defintions for subclasses' do + it "produces defintions for subclasses" do expected_definitions = { avatar: { yo: "greeting" } } foo = Class.new bar = Class.new(foo) Paperclip::AttachmentRegistry.register( foo, @@ -83,11 +83,11 @@ definitions = Paperclip::AttachmentRegistry.definitions_for(bar) assert_equal expected_definitions, definitions end - it 'produces defintions for subclasses but deep merging them' do + it "produces defintions for subclasses but deep merging them" do foo_definitions = { avatar: { yo: "greeting" } } bar_definitions = { avatar: { ciao: "greeting" } } expected_definitions = { avatar: { yo: "greeting", @@ -110,11 +110,11 @@ definitions = Paperclip::AttachmentRegistry.definitions_for(bar) assert_equal expected_definitions, definitions end - it 'allows subclasses to override attachment defitions' do + it "allows subclasses to override attachment defitions" do foo_definitions = { avatar: { yo: "greeting" } } bar_definitions = { avatar: { yo: "hello" } } expected_definitions = { avatar: { @@ -139,11 +139,11 @@ assert_equal expected_definitions, definitions end end - context '.clear' do - it 'removes all of the existing attachment definitions' do + context ".clear" do + it "removes all of the existing attachment definitions" do foo = Class.new Paperclip::AttachmentRegistry.register( foo, :greeter, ciao: "greeting"