【发布时间】:2014-02-21 00:42:11
【问题描述】:
相关信息
- 导轨 4.0.3
- 水豚2.2.1
- guard-livereload 2.2.1
- guard-rspec 4.2.6
- guard-spork 1..5.1
- 守卫茶匙 0.0.4
- phantomjs 1.9.21
- rspec-rails 2.14.4
- spork-rails 4.0.0
- 茶匙 0.7.9
在运行 Guard 时,我看到 cli 选项已被弃用。阅读继任者cmd,并按如下方式实现:
# 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
使用更改启动 Guard 后,除了 Capybara 支持的测试(功能)之外的所有测试都失败。在终端中直接运行 bundle exec 控制台会导致所有测试通过。恢复使用 cli 会导致所有测试通过。
任何想法可能是什么问题?
编辑
这是我在使用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.
恢复到cli: '--drb',测试按预期通过。
【问题讨论】:
-
你能把错误贴出来吗?
-
在编辑中添加了输出。
标签: ruby-on-rails rspec capybara guard