Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spork 0.9.2 and rspec 3.0.0 = uninitialized constant RSpec::Core::CommandLine (NameError)

Tags:

Im using spork 0.9.2 and rspec 3.0.0. When trying to run test rspec --drb I have an exception

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/test_framework/rspec.rb:11:in run_tests: uninitialized constant RSpec::Core::CommandLine (NameError)

But when changing rspec version back to 2.6 - everything is OK. Has anyone faced the same issue? Is it possible to work around?

like image 383
lx00st Avatar asked Jun 04 '14 06:06

lx00st


2 Answers

The reason is that RSpec::Core::CommandLine was removed in Rspec3

https://github.com/rspec/rspec-core/blob/master/Changelog.md

Merge RSpec::Core::CommandLine (never formally declared public) into RSpec::Core::Runner. (Myron Marston)

But spork depends on this code.

There is already an issue on spork's github and a solution can be found in a following spork's fork:

https://github.com/codecarson/spork/commit/38c79dcedb246daacbadb9f18d09f50cc837de51#diff-937afaa19ccfee172d722a05112a7c6fL6

In general - replace

::RSpec::Core::CommandLine.new(argv).run(stderr, stdout) 

with

::RSpec::Core::Runner.run(argv,stderr, stdout) 

in the soprks source code

like image 146
lx00st Avatar answered Sep 19 '22 15:09

lx00st


Like @lx00st said:

The reason is that RSpec::Core::CommandLine was removed in Rspec3

The spork gem hasn't been updated in rubygems.org. However, the fix has been merged into spork's master branch on github. You can grab it by telling bundler that you'd like to get spork from github (master) instead of rubygems.org. So do this:

This has been fixed on spork's master branch. Simple solution:

gem 'spork', github: 'sporkrb/spork', branch: 'master' 

If you're using spork-rails, just require spork via github before requiring spork-rails in your gemfile. For more info on this, see my comment here:

https://github.com/sporkrb/spork-rails/issues/26

Edit: added branch: 'master'

like image 38
Ben Avatar answered Sep 20 '22 15:09

Ben