spec/draper/factory_spec.rb in draper-2.0.0 vs spec/draper/factory_spec.rb in draper-2.1.0

- old
+ new

@@ -188,9 +188,20 @@ expect{worker.decorator}.to raise_error UninferrableDecoratorError end end end + + context "when the object is a struct" do + it "returns a singular decorator" do + object = Struct.new(:stuff).new("things") + + decorator_class = Class.new(Decorator) + worker = Factory::Worker.new(decorator_class, object) + + expect(worker.decorator).to eq decorator_class.method(:decorate) + end + end end context "for a collection object" do context "when decorator_class is a CollectionDecorator" do it "returns the .decorate method from the collection decorator" do