rspec コードで次のエラーが発生します
undefined local variable or method `render'
ここに私のコードがあります:
require 'spec_helper'
describe "messages/show.html.erb" do
it "displays the text attribute of the message" do
render
rendered.should contain("Hello world!")
end
end
これは本からのものです: 以下の RSpec の本は、私が Gemfile に追加したものです。
group :development , :test do
gem "rspec-rails", ">= 2.0.0"
gem "webrat", ">= 0.7.2"
end
ファイル show.html.erb をビュー/メッセージに追加していませんが、これではなく別のエラーが発生するはずです
奇妙なことは、これが私のマシンで以前に機能したことです。プロジェクトを削除して別のプロジェクトを作成しましたが、機能しなくなりました
gemfileを編集した後にこれらのコマンドを発行しました
bundle install
script/rails generate rspec:install
rake db:migrate