Skip to content

Commit

Permalink
Rename add_finders to has_finders
Browse files Browse the repository at this point in the history
  • Loading branch information
haines committed Oct 31, 2012
1 parent e1214d9 commit 42b6f78
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/draper/decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def initialize(input, options = {})
# inferred from the decorator class.
#
# @option options [Class, Symbol] :for The model class to find
def self.add_finders(options = {})
def self.has_finders(options = {})
extend Draper::Finders
self.finder_class = options[:for] || name.chomp("Decorator")
end
Expand Down
8 changes: 4 additions & 4 deletions spec/draper/decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@
subject.is_a?(subject.class).should be_true
end

describe ".add_finders" do
describe ".has_finders" do
it "extends the Finders module" do
ProductDecorator.should be_a_kind_of Draper::Finders
end
Expand All @@ -569,21 +569,21 @@

context "with for: symbol" do
it "sets the finder class" do
FinderDecorator.add_finders for: :product
FinderDecorator.has_finders for: :product
FinderDecorator.finder_class.should be Product
end
end

context "with for: string" do
it "sets the finder class" do
FinderDecorator.add_finders for: "some_thing"
FinderDecorator.has_finders for: "some_thing"
FinderDecorator.finder_class.should be SomeThing
end
end

context "with for: class" do
it "sets the finder_class" do
FinderDecorator.add_finders for: Namespace::Product
FinderDecorator.has_finders for: Namespace::Product
FinderDecorator.finder_class.should be Namespace::Product
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/samples/namespaced_product_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Namespace
class ProductDecorator < Draper::Decorator
add_finders
has_finders
end
end
2 changes: 1 addition & 1 deletion spec/support/samples/product_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ProductDecorator < Draper::Decorator
add_finders
has_finders

def awesome_title
"Awesome Title"
Expand Down

0 comments on commit 42b6f78

Please sign in to comment.