Lambda /应该改变RSpec Rails中的不对称性

时间:2012-11-28 09:28:27

标签: 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

确实

1 个答案:

答案 0 :(得分:1)

您可以尝试此操作(expect-change

expect { parse }.to change{Object.count}.by_at_least(1)