2

この仕様を記述するより良い方法はありますか? これは機能しますf.valid?、 f.errors を取得するために呼び出す必要があるという事実は好きではありません。

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
4

1 に答える 1

4
it "fails to save the record because the name is blank" do
  Foo.create.errors.should include :name
end
于 2012-06-14T00:56:51.910 に答える