1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00

Add decorated? method

This commit is contained in:
Andrew Haines 2012-10-30 22:47:13 +00:00
parent 7a32c79f1a
commit 834a6fd1f2
4 changed files with 20 additions and 0 deletions

View file

@ -20,6 +20,10 @@ module Draper::Decoratable
false
end
def decorated?
false
end
module ClassMethods
def decorate(options = {})
decorator_proxy = decorator_class.decorate(self.scoped, options)

View file

@ -187,6 +187,10 @@ module Draper
applied_decorators.include?(decorator_class)
end
def decorated?
true
end
# Delegates == to the decorated models
#
# @return [Boolean] true if other's model == self's model

View file

@ -29,6 +29,12 @@ describe Draper::Decoratable do
end
end
describe "#decorated?" do
it "returns false" do
subject.should_not be_decorated
end
end
describe Draper::Decoratable::ClassMethods do
shared_examples_for "a call to Draper::Decoratable::ClassMethods#decorate" do
subject { klass.limit }

View file

@ -284,6 +284,12 @@ describe Draper::Decorator do
end
end
describe "#decorated?" do
it "returns true" do
subject.should be_decorated
end
end
context(".wrapped_object") do
it "return the wrapped object" do
subject.wrapped_object.should == source