コントローラーのアクションが次のようになっている場合:
respond_to do |format|
format.html { raise 'Unsupported' }
format.js # index.js.erb
end
機能テストは次のようになります。
test "javascript response..." do
get :index
end
Respond_to ブロックの HTML ブランチを実行します。
これを試してみると:
test "javascript response..." do
get 'index.js'
end
コントローラーアクションを実行せずにビュー (index.js.erb) を実行します!