私はキュウリやカピバラとのRails 3.0.7プロジェクトを実行していると私はフラッシュかどうかを確認するステップ定義している[:エラー]が存在する:Cucumber-Capybaraでフラッシュ変数の存在を宣言するにはどうすればよいですか?
Then /^I should be able to see the main page properly$/ do
current_path.should == "/"
flash[:error].should == nil
end
私はキュウリのテストを実行すると、私が手をエラー
And I should be able to see the main page properly # features/step_definitions/user_auth_steps.rb:17
undefined method `flash' for nil:NilClass (NoMethodError)
./features/step_definitions/user_auth_steps.rb:19:in `/^I should be able to see the main page properly$/'
features/user_auth.feature:10:in `And I should be able to see the main page properly'
これは可変アサーションを処理する正しい方法ですか?私はセッション[:何か]を使用する場合、同じタイプのエラーが発生することに気付きました。