2010-12-05 12 views
3

私はレールを初めて使用しており、rails 3 tutorialを実行しています。私は統合テストを実行する際に問題があります。メソッド「訪問」(Webrat?)は常に失敗するようです。これは私がRSpecのから取得したエラーメッセージのようなものです:レールチュートリアルでの統合テストの「訪問」に問題がある

Failure/Error: visit signup_path 
Unknown Webrat mode: nil 

Please ensure you have a Webrat configuration block that specifies a mode 
in your test_helper.rb, spec_helper.rb, or env.rb (for Cucumber). 

This configure block supercedes the need to require "webrat/<framework>". 

For example: 

    Webrat.configure do |config| 
    config.mode = :rails 
    end 
# ./spec/requests/users_spec.rb:27:in `block (5 levels) in <top (required)>' 
# ./spec/requests/users_spec.rb:26:in `block (4 levels) in <top (required)>' 

私はスペック/ spec_helpers.rbに上記Webrat configureコンブロックを追加しようとした、と私はこのエラーを取得する:

Failure/Error: visit signup_path 
no such file to load -- action_controller/integration 
# ./spec/requests/users_spec.rb:27:in `block (5 levels) in <top (required)>' 
# ./spec/requests/users_spec.rb:26:in `block (4 levels) in <top (required)>' 

私は読んだことがありますこの問題について他のトピックと彼らが使うことを提案「= config.modeを:ラック」:

Failure/Error: visit signup_path 
undefined method `last_response' for #<RSpec::Core::ExampleGroup::Nested_5::Nested_1::Nested_2:0xa4b8aac> 
# ./spec/requests/users_spec.rb:27:in `block (5 levels) in <top (required)>' 
# ./spec/requests/users_spec.rb:26:in `block (4 levels) in <top (required)>' 

私は私がwin7x64にチュートリアルを開始したことに注目することが重要であるかもしれないと思い、私はそうするならば、私はこのエラーを取得し、 、bu私は、同じエラーでubuntu上のリポジトリの複製を試みました。

のgit://github.com/ender4/sample_app2.git ノートが2^

は、私は同様の話題をたくさん読みましたが、ほとんどのソリューションは以下にあり、誰が見てみたい場合はここにリポジトリがあります古いバージョンのrails/rspec/webratや他のテストフレームワーク(キュウリのようなもの)のために、私はそれらがどのように適用されるかわかりません。

ご協力いただければ幸いです。

答えて

0

私は、犯人rspec 2.2.0を見つけたと思う。 rspec 2.1.0を使用すると問題が解決するようです。

1

更新宝石へ:

group :development do 
    gem 'rspec-rails', '2.4.1' 
end 

group :test do 
    gem 'rspec', '2.4.0' 
    gem 'webrat', '0.7.1' 
end 

作品!

6

人は... あなたが見ている場合はちょっと:

障害:

1)ユーザーのサインアップの失敗は、新しいユーザー 失敗/エラーをしないでください。 未定義のローカル変数:signup_path NameErrorをご覧ください。 #

または方法 `signup_path」...あなたは正しいファイルでテスト(複数可)を配置していることを確認します:

それがで所属: /spec/requests/users_spec.rb はしていない: /spec/model/user_spec.rb

はそれをやって、すべてで学ぼう! :0 <> ...他の男のスラムを壁に見るのがはるかに簡単で、その道を避けてください! :)

関連する問題