Guard-RSpec mentions in the README that one could run specs using spring by specifying a cusom cmd
:
guard :rspec, cmd: 'spring rspec' do
# ...
end
This used to work fine, until I did a spring binstub --all
which changed my bin/spring
from...
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'spring' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require 'rubygems'
require 'bundler/setup'
load Gem.bin_path('spring', 'spring')
...to...
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast
# It gets overwritten when you run the `spring binstub` command
unless defined?(Spring)
require "rubygems"
require "bundler"
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
ENV["GEM_HOME"] = ""
Gem.paths = ENV
gem "spring", match[1]
require "spring/binstub"
end
end
Now when running guard
and hitting enter, it simply tells me this:
[2] guard(main)> <<<<< pressing enter
14:35:35 - INFO - Run all
14:35:35 - INFO - Running all specs
And a notification like "RSpec results - Failed" appears.
When changing my Guardfile
and removing spring
from the RSpec's cmd
like this...
guard :rspec, cmd: 'rspec' do
...the specs are run again, but apparently not using spring?
I also have to mention that when running spring
from the OSX terminal, nothing seems to happen:
$ spring
$
So: how must I configure Guard and RSpec to use Spring?
Update
At the moment, I have reverted my bin/spring
executable to the version before "binstubbing" it:
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'spring' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require 'rubygems'
require 'bundler/setup'
load Gem.bin_path('spring', 'spring')
And the Guardfile looks like this:
guard :rspec, cmd: 'spring rspec' do ... end
This works, but I don't think it's faster than running bare rspec
.
So I'm absolutely unsure now how to correctly run RSpec with Spring - using spring rspec
or just rspec
?