为什么会出现此错误?怎么修?
1) User should exist
Failure/Error: User.should be_valid
NoMethodError:
undefined method `valid?' for #<Class:0x94b626c>
测试是:
require 'spec_helper'
describe User do
it "should exist" do
User.should be_valid
end
it "should not allow me to create a new user without required fields" do
User.new(:email => 'bob').should_not be_valid
end
end
第二个测试工作正常,我怎样才能让第一个通过?我只是想让它检查模型是否存在