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 ?
I had the same problem. I've solved it by stopping spring and adding to my Gemfile
:
gem 'spring-commands-rspec', group: :development, require: false
Spring needs to be restarted in order to use the newly added command.
bin/spring stop
bin/rspec path/to/file.rb
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 :)
You have to restart the spring. So stop it and then re-run it
spring stop
spring rspec
Then it should works as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With