I am trying to create my first controller test using FactoryGirl for my Rails application, but I keep retrieving the following error:
uninitialized constant FactoryGirl
My Factories.rb file looks like this:
FactoryGirl.define do
factory :offer, class: "Offer" do |f|
f.title "Some title"
f.description "SomeDescription"
end
end
And my controller test looks like this:
require 'spec_helper'
describe OffersController do
def valid_session
{}
end
describe "GET index" do
before {
@offer = FactoryGirl.create(:offer)
}
it "assigns all offers as @offers" do
get :index, {}, valid_session
assigns(:offers).should eq([@offer])
end
end
end
My Gemfile looks like this:
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '>= 4.1.0', :require => false
end
What might I be missing since FactoryGirl isn't present?