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
greeter: { ciao: 'greeting' }
}
foo = Class.new
Paperclip::AttachmentRegistry.register(foo, :avatar, { yo: 'greeting' })
Paperclip::AttachmentRegistry.register(foo, :greeter, { ciao: 'greeting' })
Paperclip::AttachmentRegistry.register(foo,
:avatar,
{ yo: 'greeting' })
Paperclip::AttachmentRegistry.register(foo,
:greeter,
{ ciao: 'greeting' })
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, :avatar, expected_definitions[:avatar])
Paperclip::AttachmentRegistry.register(foo,
:avatar,
expected_definitions[:avatar])
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',
ciao: 'greeting'
}
}
}
foo = Class.new
bar = Class.new(foo)
Paperclip::AttachmentRegistry.register(foo, :avatar, foo_definitions[:avatar])
Paperclip::AttachmentRegistry.register(bar, :avatar, bar_definitions[:avatar])
Paperclip::AttachmentRegistry.register(foo,
:avatar,
foo_definitions[:avatar])
Paperclip::AttachmentRegistry.register(bar,
:avatar,
bar_definitions[:avatar])
definitions = Paperclip::AttachmentRegistry.definitions_for(bar)
......@@ -96,7 +106,9 @@ describe 'Attachment Registry' do
context '.clear' do
it 'removes all of the existing attachment definitions' do
foo = Class.new
Paperclip::AttachmentRegistry.register(foo, :greeter, { ciao: 'greeting' })
Paperclip::AttachmentRegistry.register(foo,
:greeter,
{ ciao: 'greeting' })
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