护RSpec的提到了,人们可以通过指定cusom运行使用弹簧规格的自述cmd
:
guard :rspec, cmd: 'spring rspec' do
# ...
end
这用来做工精细,直到我做了一个spring binstub --all
这改变了我的bin/spring
从...
#!/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')
...至...
#!/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
现在运行时, guard
和按下回车键,它只是告诉我:
[2] guard(main)> <<<<< pressing enter
14:35:35 - INFO - Run all
14:35:35 - INFO - Running all specs
而像一个通知 - 出现“RSpec的结果失败”。
当改变我的Guardfile
和删除spring
从RSpec的的cmd
像这样...
guard :rspec, cmd: 'rspec' do
...规格再次运行,但显然不是用春天?
我也有提到,运行时, spring
从OSX终端,好像没有什么改变:
$ spring
$
所以:我如何必须配置防护和RSpec使用Spring?
更新
目前,我已经恢复我的bin/spring
可执行文件的版本“binstubbing”之前:
#!/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')
而Guardfile看起来是这样的:
guard :rspec, cmd: 'spring rspec' do ... end
这工作,但我不认为这是比裸跑快rspec
。
所以,我现在绝对不能确定如何正确使用Spring运行RSpec的-用spring rspec
或只是rspec
?