Question

I'm developing a simple gem, and planning to use Guard to run my specs. But, it seems that Guard is not aware of the changes in the path.

(ruby-2.0.0-p247@spree-mercadopago)jperez@devartis11:~/avalancha/spree_mp$ bundle exec guard -d --watchdir /home/jperez/avalancha/spree_mp/
15:54:45 - DEBUG - Command execution: which notify-send
15:54:45 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
15:54:45 - INFO - Guard is using NotifySend to send notifications.
15:54:45 - INFO - Guard is using TerminalTitle to send notifications.
15:54:45 - DEBUG - Command execution: hash stty
15:54:45 - DEBUG - Guard starts all plugins
15:54:45 - DEBUG - Hook :start_begin executed for Guard::RSpec
15:54:45 - INFO - Guard::RSpec is running
15:54:45 - INFO - Running all specs
15:54:45 - DEBUG - Command execution: bundle exec rspec --help
15:54:46 - DEBUG - Command execution: bundle exec rspec -f progress -r /home/jperez/.rvm/gems/ruby-2.0.0-p247@spree-mercadopago/gems/guard-rspec-2.5.4/lib/guard/rspec/formatter.rb -f Guard::RSpec::Formatter --failure-exit-code 2 spec 
No DRb server is running. Running in local process instead ...
..FFFFFFFFF**FFFFFFFFFFFFFFFFFFFFFFF

Pending:
  # ...
Failures:

  #...
Finished in 23.83 seconds
36 examples, 32 failures, 2 pending

Failed examples:

# Some examples...

15:55:13 - INFO - Guard is now watching at '/home/jperez/avalancha/spree_mp'
15:55:13 - DEBUG - Start interactor
[1] guard(main)> 

Now, if I change a file, nothing happens. Although, if I notify by hand it to Guard, it does what I expect:

[1] guard(main)> c app/models/spree_mercado_pago_client.rb
Archivo modificado!!!!
HOLA
16:08:21 - DEBUG - Trying to run Guard::RSpec#run_on_modifications with ["spec/models/spree_mercado_pago_client_spec.rb"]
16:08:21 - DEBUG - Hook :run_on_changes_begin executed for Guard::RSpec
16:08:21 - INFO - Running: spec/models/spree_mercado_pago_client_spec.rb
16:08:21 - DEBUG - Command execution: bundle exec rspec -f progress -r /home/jperez/.rvm/gems/ruby-2.0.0-p247@spree-mercadopago/gems/guard-rspec-2.5.4/lib/guard/rspec/formatter.rb -f Guard::RSpec::Formatter --failure-exit-code 2 spec/models/spree_mercado_pago_client_spec.rb 
No DRb server is running. Running in local process instead ...
..FFFFFFFFF

Here's my Guardfile

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'rspec', all_after_pass:false do
  watch(%r{.*}) do |m|
    puts "Modified file!!!!"
  end


  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$}) do |m|
    puts "DEBUGGING"
    "spec/#{m[1]}_spec.rb"
  end

  watch(%r{^app/(.*)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_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" }

  # Capybara features specs
  watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/features/#{m[1]}_spec.rb" }

  # Turnip features and steps
  watch(%r{^spec/acceptance/(.+)\.feature$})
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$})   { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end

and here's my Gemfile

source 'http://rubygems.org'

gem 'spree', '~> 2.1.0'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-1-stable'


group :test do
  gem 'spork'
  gem 'guard-rspec'
  gem 'guard-spork'
  gem 'capybara'
end

gemspec

EDIT: I'm running this in Ubuntu 12.10

Was it helpful?

Solution

The problem seemed to be to have a symbolic link to my gemset in the current directory.

Do not clearly know if it was because of it being a symlink, or because the huge amount of files it had inside.

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