【发布时间】:2013-04-26 04:08:08
【问题描述】:
我的 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
【问题讨论】:
标签: ruby-on-rails-3 rspec-rails