如果具有给定属性的记录不存在,我对插入或返回第一条记录的方法进行 rspec 测试。看起来像这样
context "user doesn't exist" do
subject { User.find_or_create(name: "Jonh", login: "john") }
it { should be_an_instance_of(User) }
//and here I want to test that new user was inserted into database...
end
但我不知道如何使用expect to change
它。