Reece (3) [Avatar] Offline
#1
Hi All,

I am trying to work through the book but am currently struggling on section 4.1.3. I have followed the instructions but have been receiving the following errors. I have been stuck on this for hours now, I'm confident that my code matches the text and couldnt implement a solution using google searches after trying in various ways to require factory girl etc.

james@james-H61M-S2PV:~/Code/Rails/ticketoo2$ bin/cucumber features/viewing_projects.feature
Using the default profile...
cannot load such file -- /home/james/Code/Rails/ticketoo2/factories (LoadError)
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
/home/james/Code/Rails/ticketoo2/features/support/env.rb:51:in `<top (required)>'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/rb_support/rb_language.rb:129:in `load'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/runtime/support_code.rb:82:in `each'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/runtime.rb:175:in `load_step_definitions'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/runtime.rb:40:in `run!'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:43:in `execute!'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:20:in `execute'
/home/james/.rvm/gems/ruby-1.9.3-p194@ticketoo/gems/cucumber-1.2.1/bin/cucumber:14:in `<top (required)>'

I am using ubuntu and my gemfile is this:

source 'http://rubygems.org'

gem 'rails', '3.1.0'
gem 'sqlite3'

group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end

gem 'dynamic_form'
gem 'jquery-rails'

group :test, :development do
gem 'rspec-rails', '~> 2.5'
end

group :test do
gem 'cucumber-rails', '1.0.6'
gem 'capybara'
gem 'database_cleaner'
gem 'factory_girl'
end

Can anybody please help?

Thanks very much.
ryanbigg (423) [Avatar] Offline
#2
Re: Cannot load factory girl
Hi Reece,

Could you show us the content of `features/support/env.rb` please? Particularly line 51. I suspect you're attempting to require a directory rather than the files within that directory.

Thanks!
Reece (3) [Avatar] Offline
#3
Re: Cannot load factory girl
Hi Ryan,

I think I may have added something I shouldn't have. I have had a few issues and I'm going to start again once i've sorted out my rvm and my gems.

Thanks very much for the support.
Reece (3) [Avatar] Offline
#4
Re: Cannot load factory girl
Hi All,

I have fixed the problem that I was having, here's how...

The line that Ryan was referring to was something that I had added in an attempt to fix things. When I started the app again though I encountered the same problem of:

uninitialized constant Factory (NameError)

I fixed this by changing my factory_girl gem to gem 'factory_girl', '1.3.3' as described in this thread:

http://www.manning-sandbox.com/thread.jspa?messageID=125692𞫼

Everything is now running smoothly so thanks to the forum.