0

sporkを使用しているときにPickleがロードされていないようです...

キュウリを正常に実行すると、ステップは期待どおりに機能します。

➜ bundle exec cucumber

And a product exists with name: "Windex", category: "Household Cleaners", description: "nasty bluish stuff" # features/step_definitions/pickle_steps.rb:4

しかし、spork で実行すると、未定義のステップが発生します。

次のスニペットを使用して、未定義のステップのステップ定義を実装できます。

Given /^a product exists with name: "([^"]*)", category: "([^"]*)", description: "([^"]*)"$/ do |arg1, arg2, arg3|
  pending # express the regexp above with the code you wish you had
end

何を与える?

4

1 に答える 1

1

したがって、Spork を使用して Pickle が AR モデルをピックアップできるようにするために必要な追加の構成行があることがわかりfeatures/support/env.rbました。

features/support/env.rb

Spork.prefork do
  ENV["RAILS_ENV"] ||= "test"
  require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')

  # So that Pickle's AR adapter properly picks up the application's models.
  Dir["#{Rails.root}/app/models/*.rb"].each { |f| load f }

  # ...
end

この行に追加すると、問題が解決します。これは、ガード自体よりもスポークの問題です。質問を更新します...

于 2011-05-30T22:14:13.363 に答える