undefined method `inject' for Gem::Specification:Class (NoMethodError) #182

Javix opened this Issue Mar 2, 2012 · 8 comments


None yet

3 participants


I followed the instructions on https://github.com/sporkrb/spork/wiki/WindowsSupport where the link to Windows directions is broken: https://github.com/timcharper/spork/wiki/.

After running

C:\Documents and Settings\path to my ror app\>spork cucumber --bootstrap

I got the above exception:

undefined method `inject' for Gem::Specification:Class (NoMethodError)
C:/Ruby192/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc2-x86-mingw32/lib/spork/gem_helpers.rb:5:in `latest_specs'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc2-x86-mingw32/lib/spork/gem_helpers.rb:16:in `find_files_using_latest_spec'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc2-x86-mingw32/lib/spork.rb:101:in `detect_and_require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc2-x86-mingw32/lib/spork/test_framework.rb:167:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc2-x86-mingw32/lib/spork/runner.rb:49:in `find_test_framework'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc2-x86-mingw32/lib/spork/runner.rb:57:in `run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc2-x86-mingw32/lib/spork/runner.rb:10:in `run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc2-x86-mingw32/bin/spork:10:in `<top (required)>'
C:/Ruby192/bin/spork:19:in `load'
C:/Ruby192/bin/spork:19:in `<main>'

In the Gem file:

group :test do
  gem "factory_girl_rails", ">= 1.6.0"
  gem "cucumber-rails", ">= 1.2.1"
  gem "database_cleaner", ">= 0.7.1"
  gem "launchy", ">= 2.0.5"
  gem "capybara"  
  gem "spork-rails"

It happened on Windows XP SP3, Ruby 1.9.2, Spork (1.0.0rc2 x86-mingw32).
Any idea ?


I get this same problem. Have you managed to work around this yet?


It seems that spork is not supported by Windows for the moment, that's whay I abandonned it for development on Windows box. The rest is being done on Ubuntu.


Hmm...I am getting this on Mac OS 10.6. Anyone have an idea of why this would be on a mac?


For me I am running:
spork rspec --bootstrap

and I get
``undefined methodinject' for Gem::Specification:Class (NoMethodError)
/Users/dc/.rvm/gems/ruby-1.9.2-p180@launch3/gems/spork-1.0.0rc2/lib/spork/gem_helpers.rb:5:in latest_specs'
/Users/dc/.rvm/gems/ruby-1.9.2-p180@launch3/gems/spork-1.0.0rc2/lib/spork.rb:101:in detect_and_require'
/Users/dc/.rvm/gems/ruby-1.9.2-p180@launch3/gems/spork-1.0.0rc2/lib/spork/runner.rb:49:in find_test_framework'
/Users/dc/.rvm/gems/ruby-1.9.2-p180@launch3/gems/spork-1.0.0rc2/lib/spork/runner.rb:10:in run'
/Users/dc/.rvm/gems/ruby-1.9.2-p180@launch3/bin/spork:19:in load'



actually, turns out all I needed was to run bundle exec spork rspec --bootstrap instead


Oh, yes, I didn't think about that. I recently marked it too that for some things I had to prefix with 'bundle exec' to make them run. Thanks for pointing it out.


I'm getting the same error with a Rails project here on OS X. Running without bundle exec always fails. With Guard 0.9.0rc9 it ran fine.


it is necessary in general to prefix commands such as rake or rspec with bundle exec so that the programs run in the exact gem environment specified by the Gemfile. (For technical reasons, the only exception to this is the rails command itself.). You can eliminate the use of 'bundle exec as described By Michael Hartle here: http://ruby.railstutorial.org/chapters/static-pages#sec:eliminating_bundle_exec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment