guardでテストが自動で動かない
guardでテストの自動化を行おうとしているのですが、立ち上げることはできても、ファイルを変更しても自動でテストが起動してくれずこまっています。下記が起動時のメッセージです。
[vagrant@localhost sample_app]$ bundle exec guard
which: no notify-send in (/home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/bin:/home/vagrant/.rbenv/versions/2.2.1/bin:/usr/local/.rbenv/libexec:/home/vagrant/.rbenv/plugins/ruby-build/bin:/home/vagrant/.rbenv/shims:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/pgsql-9.3/bin:/usr/local/.rbenv/bin:/home/vagrant/bin)
09:57:29 - INFO - Guard is using TerminalTitle to send notifications.
09:57:29 - INFO - Starting Spork for RSpec
Using RSpec, Rails
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
09:57:32 - INFO - Spork server for RSpec successfully started
09:57:32 - INFO - Guard::RSpec is running
09:57:32 - INFO - Running all specs
Running tests with args ["--color", "--failure-exit-code", "2", "--format", "progress", "--format", "Guard::RSpec::Formatter", "--require", "/home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/guard-rspec-2.5.0/lib/guard/rspec/formatter.rb", "spec"]...
.......F.
Failures:
1) Static pages Home page should have the right title
Failure/Error: expect(page).to have_title("#{base_title} | Home")
expected #has_title?("Ruby on Rails Tutorial Sample App | Home") to return true, got false
# ./spec/requests/static_pages_spec.rb:13:in `block (3 levels) in <top (required)>'
Finished in 0.33095 seconds
9 examples, 1 failure
Failed examples:
rspec ./spec/requests/static_pages_spec.rb:11 # Static pages Home page should have the right title
Randomized with seed 13620
Done.
09:57:34 - INFO - Guard is now watching at '/vagrant/sample_app'
[1] guard(main)>
ここまでは動くのですが、その後ファイルを変更しても自動でテストが走ってくれません。
Guardfileが下記になります。
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require 'active_support/inflector'
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch('config/environments/test.rb')
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
watch('test/test_helper.rb') { :test_unit }
watch(%r{features/support/}) { :cucumber }
end
guard 'rspec', all_after_pass: false 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)$}) { |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' }
# Custom Rails Tutorial specs
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) do |m|
["spec/routing/#{m[1]}_routing_spec.rb",
"spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb",
"spec/acceptance/#{m[1]}_spec.rb",
(m[1][/_pages/] ? "spec/requests/#{m[1]}_spec.rb" :
"spec/requests/#{m[1].singularize}_pages_spec.rb")]
end
watch(%r{^app/views/(.+)/}) do |m|
(m[1][/_pages/] ? "spec/requests/#{m[1]}_spec.rb" :
"spec/requests/#{m[1].singularize}_pages_spec.rb")
end
watch(%r{^app/controllers/sessions_controller\.rb$}) do |m|
"spec/requests/authentication_pages_spec.rb"
end
end
環境は下記です。
centos 6.6
Rails 4.0.5
ruby 2.2.1
gem 'guard', '2.6.1'
gem 'guard-rspec', '2.5.0'
gem 'spork-rails', '4.0.0'
gem 'guard-spork', '1.5.0'
よろしくお願い致します。