1
0
Fork 0
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:
Joshua Clayton 2012-06-25 17:59:48 -04:00
parent 852b600c0d
commit 5e90ff191a

View file

@ -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}"