I\'m attempting to follow railstutorial.org, and am currently on Chapter 7, where you start using factories: http://railstutorial.org/chapters/modeling-and-viewing-users-two#sec
I have done so,
add require 'factory_girl'
to test_helper.rb
and
@user = FactoryGirl.create(:user)
In your spec use
@user = FactoryGirl(:user)
instead of
@user = Factory(:user)
For me I had to add require 'factory_girl'
to test_helper.rb
As per the latest version of Factory Girl (currently v4.0.0) rewrite factories.rb
FactoryGirl.define do
factory :user do
name "Michael Hartl"
email "mhartl@example.com"
password "foobar"
password_confirmation "foobar"
end
end
then call it from your users controller specs as:
FactoryGirl.create(:user)