質問

Relevant information

  • rails 4.0.3
  • capybara 2.2.1
  • guard-livereload 2.2.1
  • guard-rspec 4.2.6
  • guard-spork 1..5.1
  • guard-teaspoon 0.0.4
  • phantomjs 1.9.21
  • rspec-rails 2.14.4
  • spork-rails 4.0.0
  • teaspoon 0.7.9

When running Guard, I see that the cli option has been deprecated. Read up on the successor, cmd, and implemented it as such:

# Before
guard :rspec, after_all_pass: false, cli: '--drb' do
    ...
end

# After
guard :rspec, after_all_pass: false, cmd: 'bundle exec rspec --drb' do
     ...
end

After initiating Guard with the changes, all tests except Capybara-backed ones (Features) fail. Running straight bundle exec console in the terminal results in all tests passing. Reverting back to using cli results in all tests passing.

Any ideas what the issue may be?

Edit

Here is the output I am seeing for one of my tests when using cmd: 'rspec --drb'.

00:21:38 - INFO - Running: spec/features/devise/confirmations_spec.rb
Running tests with args ["--color", "--failure-exit-code", "2", "--format", "documentation", "--format", "html", "--out", "reports/rspec_results.html", "--format", "Guard::RSpec::Formatter", "--require", "spec_helper", "--require", "/Users/viet/.rvm/gems/ruby-2.1.0/gems/guard-rspec-4.2.6/lib/guard/rspec/formatter.rb", "spec/features/devise/confirmations_spec.rb"]...

Confirmations
  #new
    should accept incorrect email and not send reset email (FAILED - 1)
    should accept correct email and send instructions email (FAILED - 2)
    should accept incorrect username and not send reset email (FAILED - 3)
    should accept correct username and send instructions email (FAILED - 4)

Failures:

  1) Confirmations #new should accept incorrect email and not send reset email
     Failure/Error: within('#new_user') { fill_in 'user_login', with: 'wrong@foobar.com' }
     Capybara::ElementNotFound:
       Unable to find css "#new_user"
     # ./spec/features/devise/confirmations_spec.rb:40:in `block (3 levels) in <top (required)>'

  2) Confirmations #new should accept correct email and send instructions email
     Failure/Error: within('#new_user') { fill_in 'user_login', with: user.email }
     Capybara::ElementNotFound:
       Unable to find css "#new_user"
     # ./spec/features/devise/confirmations_spec.rb:23:in `block (3 levels) in <top (required)>'

  3) Confirmations #new should accept incorrect username and not send reset email
     Failure/Error: within('#new_user') { fill_in 'user_login', with: 'foobar' }
     Capybara::ElementNotFound:
       Unable to find css "#new_user"
     # ./spec/features/devise/confirmations_spec.rb:32:in `block (3 levels) in <top (required)>'

  4) Confirmations #new should accept correct username and send instructions email
     Failure/Error: within('#new_user') { fill_in 'user_login', with: user.name }
     Capybara::ElementNotFound:
       Unable to find css "#new_user"
     # ./spec/features/devise/confirmations_spec.rb:14:in `block (3 levels) in <top (required)>'

Finished in 2.34 seconds
4 examples, 4 failures

Failed examples:

rspec ./spec/features/devise/confirmations_spec.rb:39 # Confirmations #new should accept incorrect email and not send reset email
rspec ./spec/features/devise/confirmations_spec.rb:22 # Confirmations #new should accept correct email and send instructions email
rspec ./spec/features/devise/confirmations_spec.rb:31 # Confirmations #new should accept incorrect username and not send reset email
rspec ./spec/features/devise/confirmations_spec.rb:13 # Confirmations #new should accept correct username and send instructions email

Randomized with seed 29280

Done.

Reverting back to cli: '--drb' and the tests pass as expected.

役に立ちましたか?

解決

It seems like DRb support has been removed since guard-rspec 4.0. You can either stay with guard-rspec 3.1.0 or (better) switch to Zeus or Spring!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top