mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
Add decorated? method
This commit is contained in:
parent
7a32c79f1a
commit
834a6fd1f2
4 changed files with 20 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue