I am trying to configure FactoryGirl to work with my Cucumber tests. I added the following lines to env.rb
require 'factory_girl' Dir.glob(File.join(File.dirname(__FILE__), '../../spec/factories/*.rb')).each {|f| require f }
When I run the "cucumber function", there is no problem. Now I add a file called teacher.rb
to spec/factories
and add the following:
FactoryGirl.define do factory :teacher do first_name "John" last_name "Smith" end end
Now when I run cucumber features
, I get: uninitialized constant FactoryGirl (NameError)
I obviously missed something, but what is it? How to get a cucumber to work with Factory Girl?
Thanks!
ruby-on-rails-3 integration-testing cucumber factory-bot
Yuval Karmi
source share