Cucumber、rspec 和 Rails 3 引发错误选项:--profile

发布于 2024-10-15 19:21:15 字数 1711 浏览 1 评论 0 原文

我第一次在 Rails

3.Gemfile

group :test do
 gem "rspec"
 gem "rspec-rails"
 gem "database_cleaner"
 gem "spork"
 gem "cucumber",         :git => "git://github.com/aslakhellesoy/cucumber.git"
 gem "cucumber-rails",   :git => "git://github.com/aslakhellesoy/cucumber-rails.git"
 gem "capybara"
 gem "capybara-envjs"
 gem "launchy"
 gem "ruby-debug"
end

中使用黄瓜,并使用生成器安装黄瓜骨架,

rails generate cucumber:install --rspec --capybara

如果我运行它所运行的最简单的功能,这会生成一个 cucumber.yml

<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip

,但在测试后它会引发异常,

$ rake cucumber
bundle exec /Users/www/.rvm/rubies/ruby-1.8.7-p330/bin/ruby -I "/Users/www/.rvm/gems/ruby-1.8.7-p330@my_app/bundler/gems/cucumber-e2df150cc4fd/lib:lib" "/Users/www/.rvm/gems/ruby-1.8.7-p330@my_app/bundler/gems/cucumber-e2df150cc4fd/bin/cucumber"  --profile default
Using the default profile...
(...)
1 scenario (1 passed)
2 steps (2 passed)
0m0.146s
invalid option: --profile
Test::Unit automatic runner.
Usage: /Users/www/.rvm/gems/ruby-1.8.7-p330@my_app/bundler/gems/cucumber-e2df150cc4fd/bin/cucumber [options] [-- untouched arguments]

我找不到这个小问题的解决方案,有帮助吗?

I used cucumber for the first time with rails 3.

Gemfile

group :test do
 gem "rspec"
 gem "rspec-rails"
 gem "database_cleaner"
 gem "spork"
 gem "cucumber",         :git => "git://github.com/aslakhellesoy/cucumber.git"
 gem "cucumber-rails",   :git => "git://github.com/aslakhellesoy/cucumber-rails.git"
 gem "capybara"
 gem "capybara-envjs"
 gem "launchy"
 gem "ruby-debug"
end

and used the generator to install the cucumber skeleton

rails generate cucumber:install --rspec --capybara

this generates a cucumber.yml

<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip

if I run the simplest feature it runs through but after the test it raises an exception

$ rake cucumber
bundle exec /Users/www/.rvm/rubies/ruby-1.8.7-p330/bin/ruby -I "/Users/www/.rvm/gems/ruby-1.8.7-p330@my_app/bundler/gems/cucumber-e2df150cc4fd/lib:lib" "/Users/www/.rvm/gems/ruby-1.8.7-p330@my_app/bundler/gems/cucumber-e2df150cc4fd/bin/cucumber"  --profile default
Using the default profile...
(...)
1 scenario (1 passed)
2 steps (2 passed)
0m0.146s
invalid option: --profile
Test::Unit automatic runner.
Usage: /Users/www/.rvm/gems/ruby-1.8.7-p330@my_app/bundler/gems/cucumber-e2df150cc4fd/bin/cucumber [options] [-- untouched arguments]

I can't find the solution for this little problem, any help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

溇涏 2024-10-22 19:21:15

尝试使用cucumber 功能或简单地cucumber 而不是rake cucumber

Try using cucumber features or simply cucumber instead of rake cucumber.

对你而言 2024-10-22 19:21:15

尝试将此文件features/support/minitest_disable.rb放入以下代码:

require 'multi_test'
MultiTest.disable_autorun

并查看此讨论

Try with putting this file features/support/minitest_disable.rb the following code:

require 'multi_test'
MultiTest.disable_autorun

and see this discussion in cucumber project

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文