Return decorated collection on #to_ary for DecoratedEnumerableProxy
Correct spec to call to_ary
This commit is contained in:
parent
ca5c538133
commit
ffed5a567f
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue