【问题标题】:email-spec destroys my rake cucumber:allemail-spec 破坏了我的 rake cucumber:all
【发布时间】:2011-01-29 21:56:33
【问题描述】:

一开始效果很好:

$ 耙黄瓜:全部


但是然后
$ script/plugin install git://github.com/bmabey/email-spec.git
远程:计数对象:162,完成。
远程:压缩对象:100% (130/130),完成。
远程:总计 162(增量 18),重复使用 79(增量 13)
接收对象:100% (162/162), 127.65 KiB | 15 KiB/s,完成。
解决增量:100% (18/18),完成。
来自 git://github.com/bmabey/email-spec
 * 分支 HEAD -> FETCH_HEAD
和 $ 脚本/生成 email_spec 存在特征/step_definitions 创建功能/step_definitions/email_steps.rb

我在

中添加了'require'email_spec/cucumber'

/feature/support/env.rb

所以它看起来像:

需要 File.expand_path(File.dirname(__FILE__) + '/../../config/environment') 需要'黄瓜/导轨/世界' require 'cucumber/formatter/unicode' # 如果你不想要 Cucumber Unicode 支持,注释掉这一行 需要'email_spec/黄瓜'

现在:

耙黄瓜:全部

给我这个错误:

$ rake cucumber:all --trace (在 /Users/leonardodarioperna/Projects/frestyl/frestyl) ** 调用 cucumber:all (first_time) ** 调用黄瓜:ok (first_time) ** 调用 db:test:prepare (first_time) ** 调用 db:abort_if_pending_migrations (first_time) ** 调用环境(first_time) ** 执行环境 ** 执行 db:abort_if_pending_migrations ** 执行 db:test:prepare ** 调用 db:test:load (first_time) ** 调用 db:test:purge (first_time) ** 调用环境 ** 执行 db:test:purge ** 执行 db:test:load ** 调用 db:schema:load (first_time) ** 调用环境 ** 执行 db:schema:load ** 执行黄瓜: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 默认 cucumber.yml 未找到。请参阅黄瓜关于在 cucumber.yml 中定义配置文件的文档。您必须定义一个“默认”配置文件才能使用不带任何参数的 cucumber 命令。 键入“黄瓜 --help”以了解用法。 耙中止! 命令失败,状态为 (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 `每个' /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' /图书馆/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19

为什么?

但是命令:

$黄瓜

仍然有效

有什么想法吗?

PS 黄瓜 (0.4.4)

【问题讨论】:

    标签: ruby-on-rails email rspec cucumber


    【解决方案1】:
    $ cucumber
    

    $ rake cucumber
    

    $ rake cucumber:all
    

    是两个不同的命令。 rake 命令需要一个 cucumber.yml 文件来告诉它要传递给 cucumber 可执行文件的选项。在 Rails 应用中,默认位置是 config/cucumber.yml

    一个示例 cucumber.yml 文件是:

    default: --format progress features
    

    【讨论】:

    • 我的应用程序中有 2 个 cucumber.yml:/vendor/gems/rspec-1.2.9/cucumber.yml,如下所示:pastie.org/879942 和其他 /vendor/plugins/email- spec/examples/rails_root/cucumber.yml 看起来像这样:pastie.org/879943 为什么它说如果该文件从未更改过它可以找到它?
    • 尝试将 /vendor/plugins/email-spec/examples/rails_root/cucumber.yml 中的一个复制到您的配置文件夹中。
    【解决方案2】:

    在您的项目根文件夹中创建一个 cucumber.yml 文件,然后重试。

    【讨论】:

    • 有效! 1. 我在根文件夹中创建了一个 cucumber.yml 2. 我在里面写了:default: --format pretty features 3. $ rake cucumber:all 谢谢Paolo!
    【解决方案3】:

    你还应该在 features 下创建一个新的初始化程序,(我使用 email_spec.rb)因为 cucumber 会在你升级时覆盖 env.rb。

    features/support/email_spec.rb

    require 'email_spec/cucumber'
    

    【讨论】:

      【解决方案4】:

      我遇到了类似的情况,Paolo 提到的那个也对我有用。但唯一的问题是我已经在 config 文件夹中有 cucumber.yml,为什么要在根目录中创建新的 cucumber.yml。然后,我查看了 cucumber.yml 并删除了“--strict”,因为我有一些未定义的步骤。

      这是我的 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'] || 'progress'} --strict --tags ~@wip"
      %>
      default: <%= std_opts %> features
      wip: --tags @wip:3 --wip features
      rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
      

      更改后的内容如下:

      <%
      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 ~@wip"
      %>
      default: <%= std_opts %> features
      wip: --tags @wip:3 --wip features
      rerun: <%= rerun_opts %> --format rerun --out rerun.txt --tags ~@wip
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-06-06
        • 1970-01-01
        • 1970-01-01
        • 2012-08-22
        • 2018-04-28
        • 2017-09-30
        相关资源
        最近更新 更多