it "is invalid with a duplicate email address" do
Contact.create(
firstname: 'Joe', lastname: 'Tester',
email: '[email protected]')
contact = Contact.create(
firstname: 'Jane', lastname: 'Tester',
email: '[email protected]')
expect(contact).to have(1).errors_on(:email)
end
expect(contact) 的类型是 RSpec::Expectations::ExpectationTarget
model 有 email 的唯一性验证,但跑测试说没有 have 这个方法,搞不明白为啥?