Search code examples
ruby-on-railsruby-on-rails-3rspecspring-gem

`spring rspec` just displays spring help.. why?


I'm trying to use spring with rspec and guard on a Rails 3.2.16 project.

After installing spring and spring-commands-rspec, I created the binstubs with :

> bundle exec spring binstub --all
  * bin/rake: spring inserted
  * bin/rspec: spring inserted
  * bin/rails: spring inserted

Now trying to run spec with spring fails (gems paths and project path subtituted for legibility) :

> bin/rspec spec/
Version: 1.1.0

Usage: spring COMMAND [ARGS]

Commands for spring itself:

binstub         Generate spring based binstubs. Use --all to generate a binstub for all known commands.
help            Print available commands.
status          Show current status.
stop            Stop all spring processes for this project.

Commands for your application:

rails           Run a rails command. The following sub commands will use spring: console, runner, generate, destroy.
rake            Runs the rake command
rspec           Runs the rspec command
rspec binstub
No DRb server is running. Running in local process instead ...
gemspath/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load': cannot load such file -- [PROJECT_PATH]/rspec (LoadError)
from gemspath/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from gemspath/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `each'
from gemspath/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from gemspath/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22:in `run'
from gemspath/rspec-core-2.14.7/lib/rspec/core/runner.rb:77:in `rescue in run'
from gemspath/rspec-core-2.14.7/lib/rspec/core/runner.rb:73:in `run'
from gemspath/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in `block in autorun'

Other try :

> spring rspec

Only displays spring help

Same goes for

> spring rspec spec/

Here is the rspec binstub (bin/rspec) :

#!/usr/bin/env ruby
begin
  load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require 'bundler/setup'
load Gem.bin_path('rspec', 'rspec')

Any idea ?


Solution

  • ANSWER OUTDATED! Was fixed. See @pfleidi's answer below.

    I've solved the problem, even if i dont know why it has solved the problem.

    Just remove gem 'spring', group: :development from the Gemfile so that you only have gem 'spring-commands-rspec' left.

    Run bundle install and then spring rpsec spec will work! Its sooo fast :)