RSpec + Capybara のセットアップは簡単でいいんですが、javascriptのテストができません。 いざ本当にウェブサイトやウェブアプリのテストしようと思ったらjavascriptのテストは必須。 それを可能にするには意外にも長い道のりがあるので、まとめておきます。 想定する開発環境はこんな感じ。 Vagrant (Virtual box) CentOS 6.4 ここでつまずいたらドットインストールで学習 ローカル開発環境の構築 (全12回) - プログラミングならドットインストール Vagrant入門 (全13回) - プログラミングならドットインストール Rails4 RSpec Capybara テストについてよくわからなければ、このチュートリアルで学習。 Ruby on Rails チュートリアル:実例を使って Rails を学ぼう テスト駆動開発の定義とは、アプリケ
Capybara.javascript_driver = :poltergeist Capybara.register_driver :poltergeist do |app| Capybara::Poltergeist::Driver.new(app, :js_errors => false, :timeout => 60) end とすればよいとわかった。各オプションについて以下に説明する。 :js_errors :js_errors => falseにしたのはCapybara::Poltergeist::JavascriptError: というエラーを防ぐため。JSのエラーはよくあることなのだが、エラーが出るたびにCapybaraを止めるのは時間の無駄。ということで、JSのエラーは無視することにした。 :timeout Timeoutはデフォルトでは30秒。しかし、ログインのような時
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く