首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从cli:转换到cmd时,Capybara特性测试失败:

从cli:转换到cmd时,Capybara特性测试失败:
EN

Stack Overflow用户
提问于 2014-02-21 00:42:11
回答 1查看 323关注 0票数 0

相关信息

  • rails 4.0.3
  • 水豚2.2.1
  • 警卫-肝脏2.2.1
  • 警卫-rspec 4.2.6
  • 警卫-斯波克1.5.1
  • 护卫- 0.0.4茶匙
  • 幻影1.9.21
  • rspec-rails 2.14.4
  • 斯波克-rails 4.0.0
  • 0.7.9茶匙

在运行“警卫”时,我看到cli选项已被废弃。阅读后续程序cmd,并将其实现如下:

代码语言:javascript
复制
# 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

在启动了这些更改之后,除了Capybara支持的测试(功能)之外,所有测试都失败了。在终端中直接运行bundle exec控制台将导致所有测试通过。返回到使用cli结果的所有测试通过。

有什么想法吗?

编辑

下面是我在使用cmd: 'rspec --drb'时所看到的测试输出。

代码语言:javascript
复制
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',测试按预期通过。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-05 22:00:33

看上去像DRb支持已被移除,自保卫-rspec 4.0以来。你可以留在警卫-rspec 3.1.0,或(更好)切换到宙斯或春天!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21922859

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档