2
有没有更好的方式来编写此规范?这个作品但是我不喜欢这个事实,我不得不打电话f.valid?
得到f.errors填充。Rspec检查ActiveModel ::错误
it "fails to save the record because the name is blank" do
f = Foo.new
f.valid?
f.errors.include?(:name).should be_true
end
感谢。更干净 –