Return decorated collection on #to_ary for DecoratedEnumerableProxy

Correct spec to call to_ary
This commit is contained in:
Jonathan Greenberg and Lake Denman 2011-10-20 15:03:48 -04:00 committed by Entryway Pair
parent ca5c538133
commit ffed5a567f
2 changed files with 20 additions and 20 deletions

View File

@ -13,7 +13,7 @@ module Draper
# Implement to_arry so that render @decorated_collection is happy
def to_ary
@wrapped_collection.to_ary
@wrapped_collection.map { |member| @klass.new(member, @context) }
end
def method_missing (meth, *args, &block)

View File

@ -199,7 +199,7 @@ describe Draper::Base do
# to support Rails render @collection the returned collection
# (or its proxy) should implement #to_ary.
subject.respond_to?(:to_ary).should be true
subject.to_a.first.should == ProductDecorator.decorate(paged_array.first)
subject.to_ary.first.should == ProductDecorator.decorate(paged_array.first)
end
end