2010-03-20 90 views
1

一開始這個工作得很好:電子郵件規格破壞了我的耙黃瓜:所有

$ rake cucumber:all


但隨後
$ script/plugin install git://github.com/bmabey/email-spec.git 
remote: Counting objects: 162, done. 
remote: Compressing objects: 100% (130/130), done. 
remote: Total 162 (delta 18), reused 79 (delta 13) 
Receiving objects: 100% (162/162), 127.65 KiB | 15 KiB/s, done. 
Resolving deltas: 100% (18/18), done. 
From git://github.com/bmabey/email-spec 
* branch   HEAD  -> FETCH_HEAD 

 
$ script/generate email_spec 
     exists features/step_definitions 
     create features/step_definitions/email_steps.rb 

同時我在

「需要 'email_spec /黃瓜'

/feature/support/env.rb

所以它看起來有點像:

 
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') 
require 'cucumber/rails/world' 
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support 
require 'email_spec/cucumber' 

現在:

​​

給了我這個錯誤:

 
$ rake cucumber:all --trace 
(in /Users/leonardodarioperna/Projects/frestyl/frestyl) 
** Invoke cucumber:all (first_time) 
** Invoke cucumber:ok (first_time) 
** Invoke db:test:prepare (first_time) 
** Invoke db:abort_if_pending_migrations (first_time) 
** Invoke environment (first_time) 
** Execute environment 
** Execute db:abort_if_pending_migrations 
** Execute db:test:prepare 
** Invoke db:test:load (first_time) 
** Invoke db:test:purge (first_time) 
** Invoke environment 
** Execute db:test:purge 
** Execute db:test:load 
** Invoke db:schema:load (first_time) 
** Invoke environment 
** Execute db:schema:load 
** Execute cucumber:ok 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I "/Library/Ruby/Gems/1.8/gems/cucumber-0.4.4/lib:lib" "/Library/Ruby/Gems/1.8/gems/cucumber-0.4.4/bin/cucumber" --profile default 
cucumber.yml was not found. Please refer to cucumber's documentation on defining profiles in cucumber.yml. You must define a 'default' profile to use the cucumber command without any arguments. 
Type 'cucumber --help' for usage. 
rake aborted! 
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...] 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `sh' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1029:in `ruby' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `ruby' 
/Library/Ruby/Gems/1.8/gems/cucumber-0.4.4/lib/cucumber/rake/task.rb:68:in `run' 
/Library/Ruby/Gems/1.8/gems/cucumber-0.4.4/lib/cucumber/rake/task.rb:138:in `define_task' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 
/usr/bin/rake:19:in `load' 
/usr/bin/rake:19 

爲什麼?

但命令:

$ cucumber

仍然有效

任何想法?

PS 黃瓜(0.4.4)

回答

0

在項目中創建根文件夾中的文件cucumber.yml並再試一次。

+0

它的工作原理! 1.我所創建的根文件夾 2.我寫裏面裏面cucumber.yml: 默認:--format漂亮特點 3. $耙黃瓜:所有 謝謝保羅! – 2010-03-22 13:52:46

0
$ cucumber 

$ rake cucumber 

$ rake cucumber:all 

是兩個不同的命令。 rake命令需要一個cucumber.yml文件來告訴它傳遞給黃瓜可執行文件的選項。在Rails應用程序,默認位置爲config/cucumber.yml

一個例子cucumber.yml文件將是:

default: --format progress features 
+0

我有我的應用程序2 cucumber.yml: /vendor/gems/rspec-1.2.9/cucumber.yml 那看起來像這樣:http://pastie.org/879942 和其他 /vendor/plugins/email-spec/examples/rails_root/cucumber.yml 看起來像這樣:http://pastie.org/879943 爲什麼說它可以找到它,如果該文件從未改變? – 2010-03-21 19:12:51

+0

嘗試將/vendor/plugins/email-spec/examples/rails_root/cucumber.yml文件複製到您的配置文件夾中。 – jrallison 2010-03-21 20:55:33

+0

http://wiki.github.com/aslakhellesoy/cucumber/cucumberyml瞭解更多信息。 – jrallison 2010-03-21 20:56:05

0

此外,您應該在功能下創建一個新的初始化程序(我使用email_spec.rb),因爲當您升級時,cucumber將覆蓋env.rb。

features/support/email_spec.rb

require 'email_spec/cucumber' 
0

我遇到了類似的事情,在一個保羅提到我工作過。但唯一的問題是我已經在配置文件夾cucumber.yml,爲什麼我應該創建新的根cucumber.yml。然後,我看着cucumber.yml並刪除'--strict',因爲我有一些未定義的步驟。

這是我的黃瓜。陽明看着面前:

<% 
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'] || 'progress'} --strict --tags [email protected]" 
%> 
default: <%= std_opts %> features 
wip: --tags @wip:3 --wip features 
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags [email protected] 

這裏是變更後:

<% 
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'] || 'progress'} --tags [email protected]" 
%> 
default: <%= std_opts %> features 
wip: --tags @wip:3 --wip features 
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --tags [email protected] 
相關問題