Question

When spec or model changed, guard with options spring rspec shows next output:

04:54:44 - INFO - Running: spec/models/identity_spec.rb
Version: 1.1.2

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


Frame number: 0/0

I'm using ruby '2.1.0' and 'rails', '4.1.0.rc1' with spring. So, it looks like it doesn't run anything. I tried different cmd options.

guard :rspec do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('spec/spec_helper.rb')  { "spec" }

  # Rails example
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }
end

This throws en error:

05:04:08 - INFO - Running: spec/models/identity_spec.rb
05:04:08 - ERROR - Guard::RSpec failed to achieve its <run_on_modifications>, exception was:
> [#] NoMethodError: undefined method `parse_options' for #<RSpec::Core::ConfigurationOptions:0x007fad670937a8 @args=[]>
> [#] /Users/alder/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/guard-rspec-4.2.2/lib/guard/rspec/command.rb:33:in `_rspec_formatters'
> [#] /Users/alder/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/guard-rspec-4.2.2/lib/guard/rspec/command.rb:29:in `_visual_formatter'
> [#] /Users/alder/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/guard-rspec-4.2.2/lib/guard/rspec/command.rb:21:in `_parts'
> [#] /Users/alder/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/guard-rspec-4.2.2/lib/guard/rspec/command.rb:14:in `initialize'

Full content there with spec helper

I've tried all different variations of options rspec, spring rspec spec and other possible including without any, but had the same result.

rspec spec without guard works fine.

I found similar problem, but it works without spring.

Was it helpful?

Solution 2

Found the problem. In guard-rspec/guard-rspec.gemspec from 4.2.2 version, line:

   s.add_dependency 'rspec', '>= 2.14', '< 4.0'

Conflicted with beta version i guess. So i changed it on next:

   s.add_dependency 'rspec', '>= 2.14', '~> 3.0.0.beta2', '< 4.0'

And it works!

And by the way, option spring in cmd caused test to do nothing. So, works this:

   guard :rspec, cmd: 'rspec -f doc --color --require spec_helper ' do

And just guard :rspec do, and it consider options from .rspec file, in which i wasn't sure.

OTHER TIPS

try using

guard 'rspec', :cli => '--drb' do
  #your code
end

once I wrote this quick guild for my reference, see if that works for you

HIH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top