parent
cbe62c03e4
commit
b156635b1e
|
@ -52,7 +52,7 @@ module Draper
|
|||
# @param [Hash] options
|
||||
# see {Decorator.decorate_collection}.
|
||||
def decorate(options = {})
|
||||
decorator_class.decorate_collection(self.scoped, options)
|
||||
decorator_class.decorate_collection(scoped, options.reverse_merge(with: nil))
|
||||
end
|
||||
|
||||
# Infers the decorator class to be used by {Decoratable#decorate} (e.g.
|
||||
|
|
|
@ -112,12 +112,12 @@ module Draper
|
|||
scoped = [Product.new]
|
||||
Product.stub scoped: scoped
|
||||
|
||||
Product.decorator_class.should_receive(:decorate_collection).with(scoped, {}).and_return(:decorated_collection)
|
||||
Product.decorator_class.should_receive(:decorate_collection).with(scoped, with: nil).and_return(:decorated_collection)
|
||||
expect(Product.decorate).to be :decorated_collection
|
||||
end
|
||||
|
||||
it "accepts options" do
|
||||
options = {context: {some: "context"}}
|
||||
options = {with: ProductDecorator, context: {some: "context"}}
|
||||
Product.stub scoped: []
|
||||
|
||||
Product.decorator_class.should_receive(:decorate_collection).with([], options)
|
||||
|
|
Loading…
Reference in New Issue