Some people seem to be having problems getting pickle and factory girl
running, in particulr the factories don't seem to load.
I have done a quick test app for reference, I any folks with these
issues could report their problems with reference to any differences b/
n their setup and the following.
rails generate pickle
cd rails
script/generate cucumber
# added folloiwng lines to config/environments/cucumber.rb
config.gem 'factory_girl'
config.gem 'pickle'
rake gems:install RAILS_ENV=cucumber
script/generate pickle
script/generate model Foo name:string quantity:integer
rake db:migrate
rake db:test:prepare
# Added the following factories file in features/support/
factories.rb
# If you already have factories defined somewhere else, you could
just require them here
require 'factory_girl'
Factory.define :foo do |n|
n.name "foo" + rand(100).to_s
n.quantity rand(100)
end
# added some validates_presence_of to the foo model
class Foo < ActiveRecord::Base
validates_presence_of :name, :quantity
end
# made a feature
Feature: Factories
Scenario: title
Given a foo exists
Then a foo should exist
Running the feature works. If I remove the factories.rb file from
support, then the feature fails with validation errors.