ruby-on-rails - rails 上的 ruby 。 bundler 。 cucumber 。 rake 中止!命令失败,状态为 (1)

标签 ruby-on-rails ruby cucumber bundler

我在 Rails 3 中使用 Bundler 和 Cucumber 时遇到问题。

当我运行 $ rake cucumber 时,我得到以下输出:

bundle exec /usr/local/bin/ruby -I "/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-
0.8.5/lib:lib" "/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/bin/cucumber"  --profile default
(in /home/<username>/practice/rails/blog)
Using the default profile...
UUUU

1 scenario (1 undefined)
4 steps (4 undefined)
0m1.552s

You can implement step definitions for undefined steps with these snippets:

Given /^a post$/ do
  pending # express the regexp above with the code you wish you had
end

Given /^a name was specified$/ do
  pending # express the regexp above with the code you wish you had
end

When /^I save the post$/ do
  pending # express the regexp above with the code you wish you had
end

Then /^the post should be saving$/ do
  pending # express the regexp above with the code you wish you had
end

rake aborted!
Command failed with status (1): [bundle exec /usr/local/bin/ruby -I "/usr/l...]
/usr/local/lib/ruby/1.9.1/rake.rb:993:in `block in sh'
/usr/local/lib/ruby/1.9.1/rake.rb:1008:in `call'
/usr/local/lib/ruby/1.9.1/rake.rb:1008:in `sh'
/usr/local/lib/ruby/1.9.1/rake.rb:1092:in `sh'
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/rake/task.rb:72:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/rake/task.rb:142:in `block in define_task'
/usr/local/lib/ruby/1.9.1/rake.rb:634:in `call'
/usr/local/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
/usr/local/lib/ruby/1.9.1/rake.rb:629:in `each'
/usr/local/lib/ruby/1.9.1/rake.rb:629:in `execute'
/usr/local/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites'
/usr/local/lib/ruby/1.9.1/rake.rb:602:in `each'
/usr/local/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites'
/usr/local/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/rake.rb:581:in `invoke'
/usr/local/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `each'
/usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
/usr/local/lib/ruby/1.9.1/rake.rb:1992:in `run'
/usr/local/bin/rake:31:in `'

尽管有这个输出,但我的功能运行良好,当我添加步骤定义并传递它们时,所有更改都会正确显示在控制台中。

这是我的 Gemfile:

group :development, :test do
  gem 'cucumber-rails'
  gem 'rspec-rails', '>= 2.0.0.beta.22'
  gem 'Selenium'
  gem 'thin'
  gem 'webrat'
end

我要注意,如果我使用 bundle exec cucumbercucumber features/ 命令,我不会收到任何错误消息。

这个问题的原因是什么?我该如何解决?

谢谢。

Debian GNU/Linux 5.0.6;

ruby 1.9.2;

Ruby on Rails 3.0.0;

bundler 1.0.0;

cucumber 0.8.5;

Cucumber-Rails 0.3.2。

最佳答案

我也遇到了同样的问题。通过一些搜索,我可以弄清楚这个错误是从哪里来的,但仍然不知道如何修复它。

问题是“bundle exec ...”shell 调用正在退出,状态代码为“1”。这是 rake.rb 脚本的错误,因此它会抛出这些行。看起来这只是某种误报。

此外,只有当所有场景都通过时才会发生这种情况。即使只有一个失败,您也不会看到此错误。

关于ruby-on-rails - rails 上的 ruby 。 bundler 。 cucumber 。 rake 中止!命令失败,状态为 (1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3740523/

相关文章:

ruby-on-rails - Rails 运行程序出现段错误 (Rails 4.0.0 Ruby 2.2.2p95 CentOS7)

ruby-on-rails - 我们可以将一个大的小型测试文件 (some_controller_test.rb) 分解成多个测试文件吗

ruby - 线程死锁

ruby - 通过 Ruby 遏制的 Bing 搜索 API

ios - Frank 自动化框架是否为故障场景提供屏幕截图捕获选项?

ruby-on-rails - ActiveRecord 加入 : integer columns converted to strings

ruby - Array#sample 是否保证随机顺序?

android - 为什么我的 Cucumber 定义步骤在 Android Studio 中未定义

java - 如何验证页面上的所有元素?

ruby-on-rails - 如何让我的帖子按时间顺序显示? (从最新到最旧)