diff --git a/lib/draper/decorated_association.rb b/lib/draper/decorated_association.rb index 4bede83..f1771fa 100644 --- a/lib/draper/decorated_association.rb +++ b/lib/draper/decorated_association.rb @@ -10,7 +10,7 @@ module Draper end def call - return undecorated if undecorated.nil? || undecorated == [] + return undecorated if undecorated.nil? decorate end diff --git a/spec/draper/decorated_association_spec.rb b/spec/draper/decorated_association_spec.rb index f48a8af..46471e2 100644 --- a/spec/draper/decorated_association_spec.rb +++ b/spec/draper/decorated_association_spec.rb @@ -22,10 +22,11 @@ describe Draper::DecoratedAssociation do end context "when the association is empty" do - it "doesn't decorate the collection" do + it "returns an empty collection decorator" do source.stub(:similar_products).and_return([]) - subject.should_not be_a Draper::CollectionDecorator + subject.should be_a Draper::CollectionDecorator subject.should be_empty + subject.first.should be_nil end end end @@ -44,10 +45,11 @@ describe Draper::DecoratedAssociation do end context "when the association is empty" do - it "doesn't decorate the collection" do + it "returns an empty collection decorator" do source.stub(:poro_similar_products).and_return([]) - subject.should_not be_a Draper::CollectionDecorator + subject.should be_a Draper::CollectionDecorator subject.should be_empty + subject.first.should be_nil end end end