http://github.com/diaspora/diaspora/blob/master/spec/models/profile_spec.rbから
describe Profile do
before do
@person = Factory.build(:person)
end
describe 'requirements' do
it "should include a first name" do
@person.profile = Factory.build(:profile,:first_name => nil)
@person.profile.valid?.should be false
@person.profile.first_name = "Bob"
@person.profile.valid?.should be true
end
end
end
しかし、http://github.com/diaspora/diaspora/blob/master/app/models/profile.rbでは、姓と名の両方の存在が検証されています。validates_presence_of :first_name, :last_name
姓が指定されていないにもかかわらず、上記のテストがパスするのはなぜですか?