1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/features/step_definitions/factory_girl_steps.rb
Joshua Clayton c47affb1aa Requiring factory definition files now works in 1.9 outside of tests
Ruby 1.9 doesn't automatically include . in the load path; if we do a
require to a relative path (eg a file within spec or test), 1.9 will raise a
LoadError because spec or test isn't normally in the load path.
2011-07-22 11:53:21 -04:00

10 lines
403 B
Ruby

When /^"([^"]*)" is added to Factory Girl's file definitions path$/ do |file_name|
new_factory_file = File.join(current_dir, file_name.gsub(".rb", ""))
FactoryGirl.definition_file_paths ||= []
FactoryGirl.definition_file_paths << new_factory_file
FactoryGirl.find_definitions
end
When /^I create a "([^"]*)" instance from Factory Girl$/ do |factory_name|
FactoryGirl.create(factory_name)
end