Skip to content

Specs are not running after file change #262

@leemour

Description

@leemour

When a file changes, Guard notices it, tries to run the specs but nothing happens.
However, if I hit enter all specs are run.
Terminal output:

leemour@ubu:~/Ruby/underflow$ bundle exec guard -d
14:21:19 - DEBUG - Command execution: which notify-send
14:21:19 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
14:21:19 - INFO - Guard is using NotifySend to send notifications.
14:21:19 - INFO - Guard is using TerminalTitle to send notifications.
14:21:19 - DEBUG - Command execution: hash stty
14:21:19 - DEBUG - Guard starts all plugins
14:21:19 - DEBUG - Hook :start_begin executed for Guard::RSpec
14:21:19 - INFO - Guard::RSpec is running
14:21:19 - DEBUG - Hook :start_end executed for Guard::RSpec
14:21:19 - INFO - Guard is now watching at '/home/leemour/Ruby/underflow'
14:21:19 - DEBUG - Start interactor
14:22:15 - DEBUG - Stop interactor
14:22:15 - DEBUG - Trying to run Guard::RSpec#run_on_additions with ["spec/models/user_spec.rb"]
14:22:15 - DEBUG - Trying to run Guard::RSpec#run_on_changes with ["spec/models/user_spec.rb"]
14:22:15 - DEBUG - Trying to run Guard::RSpec#run_on_change with ["spec/models/user_spec.rb"]
14:22:15 - DEBUG - Start interactor
[1] guard(main)> 
14:22:18 - INFO - Run all
14:22:18 - DEBUG - Hook :run_all_begin executed for Guard::RSpec
14:22:18 - INFO - Running all specs

User
  should have many questions
  should ensure name has a length of at least 3

Finished in 0.08511 seconds
2 examples, 0 failures

Randomized with seed 42580

23:16:39 - DEBUG - Command execution: notify-send RSpec results 2 examples, 0 failures in 0.0851 seconds -t 3000 -h int:transient:1 -i /home/leemour/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/guard-2.6.0/images/success.png -u low

23:16:39 - DEBUG - Hook :run_all_end executed for Guard::RSpec
[2] guard(main)>

Guardfile:

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/(.*)(\.erb|\.haml|\.slim)$})          { |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|slim)$})     { |m| "spec/features/#{m[1]}_spec.rb" }
end

Gemfile:

ruby '2.1.0'
source 'https://rubygems.org'

gem 'rails', '4.1.0'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'pg'
gem 'turbolinks'


group :development, :test do
  gem 'spring'
  gem 'rspec-rails'
  gem 'spring-commands-rspec'
  gem 'guard-rspec'
  gem "rb-readline", "~> 0.5.0"
  gem 'factory_girl_rails'
end

I can see in my terminal Trying to run Guard::RSpec#run_on_additions with ["spec/models/user_spec.rb"] and other methods (run_on_changes, run_on_change) are called but I couldn't find them in guard-rspec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions