黄瓜最后测试奇怪的错误

时间:2013-09-17 21:31:45

标签: ruby-on-rails ruby cucumber

运行黄瓜测试时出现奇怪的错误。所有测试运行正常,但最后会出现此错误:

→ bundle exec rake cucumber
/Users/rudolf/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -S bundle exec cucumber  --profile default
Using the default profile...

(All tests run properly at this point)

27 scenarios (27 passed)
245 steps (245 passed)
0m27.778s
/Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1037:in `block in process_args': invalid option: --profile (OptionParser::InvalidOption)
    from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1016:in `new'
    from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1016:in `process_args'
    from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1066:in `_run'
    from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1059:in `run'
    from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:795:in `block in autorun'

我正在使用Ruby 2和Rails 4,这是我的Gemfile中的测试部分:

group :development, :test do
  gem 'rspec-rails'
  gem 'capybara'
  gem 'cucumber-rails', require: false
  gem 'selenium-webdriver'
  gem 'database_cleaner'
  gem 'shoulda-matchers'
  gem 'nokogiri'
end

我也在Semaphore(https://semaphoreapp.com)上运行这些测试,它也在那里发生。

修改: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

1 个答案:

答案 0 :(得分:2)

我通过大量的谷歌搜索和尝试来解决这个问题:当我跑步时

bundle exec cucumber

或仅

cucumber

(没有rake)它可以正常工作。这并不能解决问题,但至少它现在可以解决了。