Skip to content

Commit

Permalink
Add similar methods to Decoratable
Browse files Browse the repository at this point in the history
  • Loading branch information
haines committed Oct 30, 2012
1 parent 0bbcd19 commit 7a32c79
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/draper/decoratable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ def decorator_class

alias :decorate :decorator

def applied_decorators
[]
end

def decorated_with?(decorator_class)
false
end

module ClassMethods
def decorate(options = {})
decorator_proxy = decorator_class.decorate(self.scoped, options)
Expand All @@ -22,4 +30,4 @@ def decorator_class
"#{model_name}Decorator".constantize
end
end
end
end
12 changes: 12 additions & 0 deletions spec/draper/decoratable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
end
end

describe "#applied_decorators" do
it "returns an empty list" do
subject.applied_decorators.should be_empty
end
end

describe "#decorated_with?" do
it "returns false" do
subject.should_not be_decorated_with(ProductDecorator)
end
end

describe Draper::Decoratable::ClassMethods do
shared_examples_for "a call to Draper::Decoratable::ClassMethods#decorate" do
subject { klass.limit }
Expand Down

0 comments on commit 7a32c79

Please sign in to comment.