[rspec-users] having some issues with factory_girl and bundler...

Craig Demyanovich cdemyanovich at gmail.com
Mon Sep 27 18:22:50 EDT 2010


On Mon, Sep 27, 2010 at 5:05 PM, Justin Ko <jko170 at gmail.com> wrote:

>
>
> On Sep 27, 4:11 pm, Carmen Díaz Echauri <cdecha... at gmail.com> wrote:
> > Hi All
> >
> > Need some brilliants minds here :)
> >
> > I'm using Rails 2.3.8 & ruby 1.8 (I know, I know... )
> > I've move my gems from .gems to Bundler, but I'm having some issues with
> > Factory_girl when I rake spec
> > "uninitialized constant Factory"
>

...


> Try:
>
> gem 'factory_girl_rails'


According to http://github.com/thoughtbot/factory_girl, that's only for
Rails 3: "If you want to use factory_girl with Rails 3, see
github.com/thoughtbot/factory_girl_rails."

I've been working on moving a Rails 2.3.9 app to Bundler 1.0.0 from a custom
solution. The app uses factory_girl with rspec and cucumber, and all the
specs and cukes run successfully. At the bottom of
config/environments/cucumber.rb, I have require 'factory_girl'. I don't have
any similar requires in config/environments/test.rb or in
spec/spec_helper.rb.

Here's the current Gemfile:

source "http://rubygems.org"

gem "rails", "~> 2.3.9"

gem "rake",          "~> 0.8.7"
gem "haml",          "~> 3.0.18"
gem "fastercsv",     "~> 1.5.3"
gem "will_paginate", "~> 2.3.12"

gem "rspec",            "~> 1.3.0",  :group => [:test, :cucumber]
gem "rspec-rails",      "~> 1.3.2",  :group => [:test, :cucumber]
gem "capybara",         "~> 0.3.8",  :group => [:cucumber]
gem "cucumber",         "~> 0.7.3",  :group => [:cucumber]
gem "cucumber-rails",   "~> 0.3.1",  :group => [:cucumber]
gem "gherkin",          "~> 1.0.30", :group => [:cucumber]
gem "database_cleaner", "~> 0.5.0",  :group => [:cucumber]
gem "dupe",             "~> 0.5.1",  :group => [:test, :cucumber]
gem "factory_girl",     "~> 1.2.4",  :group => [:test, :cucumber]

platforms :jruby do
  gem "jruby-openssl", "~> 0.7.1"
  gem "jruby-rack",    "~> 1.0.3"
  gem "warbler",       "~> 1.0.1"
  gem "flying_saucer", "~> 0.8.0"

  group :db do
    gem "jdbc-mysql",                     "~> 5.0.4"
    gem "activerecord-jdbc-adapter",      "~> 0.9.2"
    gem "activerecord-jdbcmysql-adapter", "~> 0.9.2"
  end

end

Note that I'm not using the :require option with gem "factory_girl."

Since I don't have any ideas about your specific errors and I have to head
out to an appointment, I hope all of this helps.

Regards,
Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100927/15dddae8/attachment.html>


More information about the rspec-users mailing list