为什么
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
做?
为什么
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
做?
你可以试试这个(expect-change)
expect { parse }.to change{Object.count}.by_at_least(1)