标签: ruby-on-rails rspec
为什么
lambda { parse }.should change(Object.all, :length).by_at_least(1)
无效,而
obj_count_before=Object.all.length parse Object.all.length.should >= obj_count_before +1
确实
答案 0 :(得分:1)
您可以尝试此操作(expect-change)
expect { parse }.to change{Object.count}.by_at_least(1)