Carmen Díaz Echauri
2010-Sep-27 20:11 UTC
[rspec-users] having some issues with factory_girl and bundler...
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" I''m following the instructions from http://gembundler.com/rails23.html. Basically: - grab all config.gem and place them into Gemfile - bundle install - check Gemfile.lock in my repository .. etc I even tried with a new dummy app from scratch and got the samething... /script/console test Loading test environment (Rails 2.3.8)>> FactoryNameError: uninitialized constant Factory from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:443:in `load_missing_constant'' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:92:in `const_missing'' from (irb):1>> require ''factory_girl''=> true>>My Gemfile looks like this source :gemcutter # gem "rails", "2.3.8" gem "memcached-northscale" gem "uuidtools", ">= 1.0.2" gem "json", ">= 1.2.4" gem "nokogiri", ">= 1.4.0" gem "tzinfo", ">=0.3.5" gem "SystemTimer", ">=1.1.3" gem "will_paginate", ">= 2.3.11" gem "taf2-curb", ">=0.3.5.0" gem "pg" gem "hoptoad_notifier" gem "treetop" gem "term-ansicolor" gem "diff-lcs" group :development, :test do gem "factory_girl", :require => ''factory Note: last tried... Placing it outside of the groups, throw the same error... gem "rspec" gem "rspec-rails", ">= 1.3.2" gem "webrat", ">=0.5.3" gem "ruby-debug" end Any ideas? Suggestions? BTW Samething is happening with will_paginate Thanks a lot for your help. You guys rock! -- Carmen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100927/1a991fe5/attachment.html>
Justin Ko
2010-Sep-27 21:05 UTC
[rspec-users] having some issues with factory_girl and bundler...
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" > > I''m following the instructions fromhttp://gembundler.com/rails23.html. > Basically: > - grab all config.gem and place them into Gemfile > - bundle install > - check ?Gemfile.lock in my repository .. etc > > ?I even tried with a new dummy app from scratch and got the samething... > /script/console test > Loading test environment (Rails 2.3.8) > > >> Factory > > NameError: uninitialized constant Factory > ? ? from > /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependen cies.rb:443:in > `load_missing_constant'' > ? ? from > /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependen cies.rb:80:in > `const_missing'' > ? ? from > /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependen cies.rb:92:in > `const_missing'' > ? ? from (irb):1 > > >> require ''factory_girl'' > => true > > My Gemfile looks like this > > source :gemcutter > # > gem "rails", "2.3.8" > gem "memcached-northscale" > gem "uuidtools", ?">= 1.0.2" > gem "json", ?">= 1.2.4" > gem "nokogiri", ?">= 1.4.0" > gem "tzinfo", ?">=0.3.5" > gem "SystemTimer", ">=1.1.3" > gem "will_paginate", ">= 2.3.11" > gem "taf2-curb", ">=0.3.5.0" > gem "pg" > gem "hoptoad_notifier" > gem "treetop" > gem "term-ansicolor" > gem "diff-lcs" > > group :development, :test do > ? gem "factory_girl", :require => ''factory ?Note: last tried... Placing it > outside of the groups, throw the same error... > ? gem "rspec" > ? gem "rspec-rails", ">= 1.3.2" > ? gem "webrat", ">=0.5.3" > ? gem "ruby-debug" > end > > Any ideas? Suggestions? > BTW Samething is happening with will_paginate > > Thanks a lot for your help. ?You guys rock! > > -- > Carmen > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-usersTry: gem ''factory_girl_rails''
Craig Demyanovich
2010-Sep-27 22:22 UTC
[rspec-users] having some issues with factory_girl and bundler...
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>
Justin Ko
2010-Sep-27 22:28 UTC
[rspec-users] having some issues with factory_girl and bundler...
On Sep 27, 6:22?pm, Craig Demyanovich <cdemyanov... at gmail.com> wrote:> On Mon, Sep 27, 2010 at 5:05 PM, Justin Ko <jko... 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 tohttp://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 > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-usersMy only guess is he is calling Factory somewhere where it is not available.