Rename add_finders to has_finders
This commit is contained in:
parent
e1214d97b6
commit
42b6f78fda
|
@ -36,7 +36,7 @@ module Draper
|
|||
# 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
|
||||
|
|
|
@ -550,7 +550,7 @@ describe Draper::Decorator do
|
|||
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
|
||||
|
@ -569,21 +569,21 @@ describe Draper::Decorator do
|
|||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,6 @@ require './spec/support/samples/namespaced_product'
|
|||
|
||||
module Namespace
|
||||
class ProductDecorator < Draper::Decorator
|
||||
add_finders
|
||||
has_finders
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ProductDecorator < Draper::Decorator
|
||||
add_finders
|
||||
has_finders
|
||||
|
||||
def awesome_title
|
||||
"Awesome Title"
|
||||
|
|
Loading…
Reference in New Issue