mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
Follow pattern for raising when instantiating
This commit is contained in:
parent
852b600c0d
commit
5e90ff191a
1 changed files with 2 additions and 2 deletions
|
@ -5,7 +5,7 @@ module FactoryGirl
|
|||
def initialize(name, block)
|
||||
@name = name.to_sym
|
||||
@block = block
|
||||
check_name
|
||||
ensure_valid_callback_name!
|
||||
end
|
||||
|
||||
def run(instance, evaluator)
|
||||
|
@ -26,7 +26,7 @@ module FactoryGirl
|
|||
|
||||
private
|
||||
|
||||
def check_name
|
||||
def ensure_valid_callback_name!
|
||||
unless FactoryGirl.callback_names.include?(name)
|
||||
raise InvalidCallbackNameError, "#{name} is not a valid callback name. " +
|
||||
"Valid callback names are #{FactoryGirl.callback_names.inspect}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue