我正在尝试设置黄瓜,rspec,护卫和spork。我的rspec工作得很好,但黄瓜在下面跟踪时崩溃了。
我已尝试多次设置, rails g cucumber:安装--spork spork黄瓜 - boostrap 等等......没有运气。
宝石: 铁轨(3.1.3) 守卫(0.10.0) 后卫捆绑(0.1.3) 保护黄瓜(0.7.4,0.7.3) 护栏(0.0.3) guard-rspec(0.6.0,0.5.2) 防护叉(0.5.1,0.5.0) 黄瓜(1.1.4) 黄瓜栏杆(1.2.1) spork(0.9.0)
Running all features
Using the default profile...
Running tests with args ["--color", "--format", "pretty", "--require", "/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/guard-cucumber-0.7.4/lib/guard/cucumber/notification_formatter.rb", "--format", "Guard::Cucumber::NotificationFormatter", "--out", "/dev/null", "--require", "features", "features", "--format", "pretty", "--strict", "--tags", "~@wip", "features", "--no-profile"]...
Disabling profiles...
Exception encountered: #<RuntimeError: All but one formatter must use --out, only one can print to each stream (or STDOUT)>
backtrace:
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/cucumber-1.1.4/lib/cucumber/cli/configuration.rb:198:in `arrange_formats'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/cucumber-1.1.4/lib/cucumber/cli/configuration.rb:26:in `parse!'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/cucumber-1.1.4/lib/cucumber/cli/main.rb:55:in `configuration'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/cucumber-1.1.4/lib/cucumber/cli/main.rb:63:in `run_drb_client'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/cucumber-1.1.4/lib/cucumber/cli/main.rb:34:in `execute!'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/spork-0.9.0/lib/spork/test_framework/cucumber.rb:24:in `run_tests'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:13:in `block in run'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/spork-0.9.0/lib/spork/forker.rb:21:in `block in initialize'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/spork-0.9.0/lib/spork/forker.rb:18:in `fork'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/spork-0.9.0/lib/spork/forker.rb:18:in `initialize'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:9:in `new'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:9:in `run'
/Users/matt/.rvm/gems/ruby-1.9.2-p290@alphascore/gems/spork-0.9.0/lib/spork/server.rb:48:in `run'
/Users/matt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
/Users/matt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
/Users/matt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
/Users/matt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
/Users/matt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'
Done.
答案 0 :(得分:1)
我终于解决了这个问题,在通过我的护卫文件传递给黄瓜的标志后,我能够解决冲突的标志,而不是覆盖我的cucumber.yml标志。
工作警卫档案
guard 'cucumber', :cli => "--drb" do
watch(%r{^features/.+\.feature$})
watch(%r{^features/support/.+$}) { 'features' }
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
end
<强> 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: --drb <%= std_opts %> features
wip: --drb --tags @wip:3 --wip features
rerun: --drb <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
冲突的Guardfile
guard 'cucumber', :cli => "--drb --color --format pretty" do
watch(%r{^features/.+\.feature$})
watch(%r{^features/support/.+$}) { 'features' }
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
end