From 65e3c4e4573173b510440b7e80f95a87109a1d15 Mon Sep 17 00:00:00 2001 From: "Carlos Eduardo L. Lopes" Date: Wed, 6 Feb 2013 11:05:40 -0200 Subject: [PATCH] Added #decorated? method to Draper::CollectionDecorator Closes #447 --- lib/draper/collection_decorator.rb | 5 +++++ spec/draper/collection_decorator_spec.rb | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/draper/collection_decorator.rb b/lib/draper/collection_decorator.rb index dc66296a..ad28a6c2 100644 --- a/lib/draper/collection_decorator.rb +++ b/lib/draper/collection_decorator.rb @@ -70,6 +70,11 @@ def decorator_class @decorator_class ||= self.class.inferred_decorator_class end + # @return [true] + def decorated? + true + end + protected # @return the collection being decorated. diff --git a/spec/draper/collection_decorator_spec.rb b/spec/draper/collection_decorator_spec.rb index 756514b1..aefc182a 100644 --- a/spec/draper/collection_decorator_spec.rb +++ b/spec/draper/collection_decorator_spec.rb @@ -255,5 +255,13 @@ module Draper end end + describe '#decorated?' do + it 'returns true' do + decorator = ProductsDecorator.new([Product.new]) + + expect(decorator).to be_decorated + end + end + end end