I'm a high school student who is new to Ruby on Rails and trying to develop a Rails 4 application with TDD. I am using guard along with rspec, spork, and growl notifications, but when I run guard to run my tests, I get the following output and no results from the tests:
11 clairehuang:mezzo$ guard
18:23:31 - INFO - Guard is using GrowlNotify to send notifications.
18:23:31 - INFO - Guard is using TerminalTitle to send notifications.
18:23:31 - INFO - Starting Spork for RSpec
Using RSpec, Unknown
Loading Spork.prefork block...
Spork is ready and listening on 8989!
18:23:33 - INFO - Spork server for RSpec successfully started
18:23:33 - INFO - LiveReload is waiting for a browser to connect.
18:23:33 - INFO - Guard::RSpec is running
18:23:33 - INFO - Running all specs
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/growl_notify-0.0.3/lib/growl_notify.rb:53: warning: instance variable @icon not initialized
18:23:34 - INFO - Guard is now watching at '/Users/clairehuang/Sites/mezzo'
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:76: warning: global variable `$CELLULOID_DEBUG' not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:76: warning: global variable `$CELLULOID_DEBUG' not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:76: warning: global variable `$CELLULOID_DEBUG' not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:76: warning: global variable `$CELLULOID_DEBUG' not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:76: warning: global variable `$CELLULOID_DEBUG' not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/guard-2.6.1/lib/guard/interactor.rb:64: warning: instance variable @enabled not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/guard-2.6.1/lib/guard/interactor.rb:64: warning: instance variable @enabled not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/guard-2.6.1/lib/guard/interactor.rb:64: warning: instance variable @enabled not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/guard-2.6.1/lib/guard/interactor.rb:64: warning: instance variable @enabled not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/guard-2.6.1/lib/guard/interactor.rb:129: warning: instance variable @thread not initialized
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/pry-0.10.0/lib/pry/method.rb:383: warning: instance variable @method not initialized
[1] guard(main)>
If I only run rspec independently of guard, my tests run okay and display an output:
13 clairehuang:mezzo$ rspec
/Users/clairehuang/.rvm/gems/ruby-1.9.3-p448/gems/spork-1.0.0rc4/lib/spork.rb:83: warning: assigned but unused variable - method_name_with_spork
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
F
Failures:
1) Donations GET /donations should display some donations
Failure/Error: visit donations_path
NameError:
undefined local variable or method `donations_path' for #<RSpec::ExampleGroups::Donations::GETDonations:0x007ffd038e5118>
# ./spec/requests/donations_spec.rb:6:in `block (3 levels) in <top (required)>'
Deprecation Warnings:
RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values= is deprecated, it is now set to true as default and setting it to false has no effect.
If you need more of the backtrace for any of these deprecations to
identify where to make the necessary changes, you can configure
`config.raise_errors_for_deprecations!`, and it will turn the
deprecation warnings into errors, giving you the full backtrace.
1 deprecation warning total
Finished in 0.00081 seconds (files took 0.20421 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/requests/donations_spec.rb:5 # Donations GET /donations should display some donations
How can I get my tests to run with guard? Thank you very much in advance!
Guardfile:
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 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
end
guard :rspec, :all_on_start => true, :cmd => "--drb" 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" }
# 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