Commit 7d2904de by Agustin Cavilliotti Committed by Jon Yurek

Arrangements in the spec file to take care of some @houndci comments

parent 1d621d81
...@@ -54,38 +54,48 @@ describe 'Attachment Registry' do ...@@ -54,38 +54,48 @@ describe 'Attachment Registry' do
greeter: { ciao: 'greeting' } greeter: { ciao: 'greeting' }
} }
foo = Class.new foo = Class.new
Paperclip::AttachmentRegistry.register(foo, :avatar, { yo: 'greeting' }) Paperclip::AttachmentRegistry.register(foo,
Paperclip::AttachmentRegistry.register(foo, :greeter, { ciao: 'greeting' }) :avatar,
{ yo: 'greeting' })
Paperclip::AttachmentRegistry.register(foo,
:greeter,
{ ciao: 'greeting' })
definitions = Paperclip::AttachmentRegistry.definitions_for(foo) definitions = Paperclip::AttachmentRegistry.definitions_for(foo)
assert_equal expected_definitions, definitions assert_equal expected_definitions, definitions
end end
it "produces defintions for subclasses" do it 'produces defintions for subclasses' do
expected_definitions = { avatar: { yo: 'greeting' } } expected_definitions = { avatar: { yo: 'greeting' } }
foo = Class.new foo = Class.new
bar = Class.new(foo) bar = Class.new(foo)
Paperclip::AttachmentRegistry.register(foo, :avatar, expected_definitions[:avatar]) Paperclip::AttachmentRegistry.register(foo,
:avatar,
expected_definitions[:avatar])
definitions = Paperclip::AttachmentRegistry.definitions_for(bar) definitions = Paperclip::AttachmentRegistry.definitions_for(bar)
assert_equal expected_definitions, definitions assert_equal expected_definitions, definitions
end 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' } } foo_definitions = { avatar: { yo: 'greeting' } }
bar_definitions = { avatar: { ciao: 'greeting' } } bar_definitions = { avatar: { ciao: 'greeting' } }
expected_definitions = { expected_definitions = {
avatar: { avatar: {
yo: 'greeting', yo: 'greeting',
ciao: 'greeting' ciao: 'greeting'
} }
} }
foo = Class.new foo = Class.new
bar = Class.new(foo) bar = Class.new(foo)
Paperclip::AttachmentRegistry.register(foo, :avatar, foo_definitions[:avatar]) Paperclip::AttachmentRegistry.register(foo,
Paperclip::AttachmentRegistry.register(bar, :avatar, bar_definitions[:avatar]) :avatar,
foo_definitions[:avatar])
Paperclip::AttachmentRegistry.register(bar,
:avatar,
bar_definitions[:avatar])
definitions = Paperclip::AttachmentRegistry.definitions_for(bar) definitions = Paperclip::AttachmentRegistry.definitions_for(bar)
...@@ -96,7 +106,9 @@ describe 'Attachment Registry' do ...@@ -96,7 +106,9 @@ describe 'Attachment Registry' do
context '.clear' do context '.clear' do
it 'removes all of the existing attachment definitions' do it 'removes all of the existing attachment definitions' do
foo = Class.new foo = Class.new
Paperclip::AttachmentRegistry.register(foo, :greeter, { ciao: 'greeting' }) Paperclip::AttachmentRegistry.register(foo,
:greeter,
{ ciao: 'greeting' })
Paperclip::AttachmentRegistry.clear Paperclip::AttachmentRegistry.clear
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment