我有以下规格的spec/views/users/new.html.erb_spec.rb
:无法获得RSpec的视图规范通过
require 'spec_helper'
describe "users/new.html.erb" do
it "displays the text attribute of the message" do
render
response.should contain("Register")
end
end
但是当我运行测试失败:
ActionView::TemplateError in 'users/new.html.erb displays the text attribute of the message'
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
线是失败的是:
<% form_for @user, :url => account_path do |f| %>
在我Users
控制器为new
方法,我有这样的:
@user = User.new
任何想法,为什么我得到那个错误?
更新:根据要求,这里是我的路线文件...
ActionController::Routing::Routes.draw do |map|
map.resource :account, :controller => "users"
map.resources :users
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
你可以发布你的路由文件? – 2010-09-27 17:47:45
发布路由更新 – Shpigford 2010-09-27 17:55:34