背景
capybara + poltergeistでフィーチャーテストを書いた
※下の記事を参考にしました
http://qiita.com/jnchito/items/bdd80c1085fa082e7d7a
現象
テストが通らない...
Failure/Error: expect(page).to have_content 'user[pref]'
何でや!
調査
HTML見てみよう...
feature 'User pages' do
scenario 'select hoge', js: true do
visit new_user_path
+ File.write("page.html", page.html)
(略)
end
end
$ vim page.html
ややっHTMLがエラー画面ではありませんか
(消してしまいました)
変なエラー出てる...
ActionView::Template::Error:
marshal data too short
どうすりゃええんや
解決
$ rake tmp:clear
で
$ bundle exec rspec -fd spec/features
直った
1 example, 0 failures
原因
tmp/sessionsに変な(大きすぎる?)データがあったっぽい(証拠が残っていません...)
参考
`marshal data too short` error when executing a capybara test using poltergeist a few times