我的课
class Review
include MongoMapper::EmbeddedDocument
key :user_name, String, :require => true
key :user_avatar, String, :require => true
end
Rspec 代码
it "when user name is not present" do
blank = FactoryGirl.build(:review, user_name: nil)
blank.should_not be_valid
end
为什么会引发此错误?
1) Review when user name is not present
Failure/Error: blank.should_not be_valid
expected #<Review _id: BSON::ObjectId('5236d401ebe86612fe000006'), user_avatar: "#<Avatar:0xb60083c>")> not to be valid