How to attach message to rspec check?

后端 未结 3 2111
野的像风
野的像风 2021-02-01 13:41

In rspec: Can I attach a message to a check the same way as I would do in xUnit style test frameworks? How?

assert_equal value1, value2, \"something is wrong\"
<         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-01 13:51

    In my case it was a problem of parenthesis:

            expect(coder.is_partial?(v)).to eq p, "expected #{v} for #{p}"
    

    this resulted in a wrong number of arguments, while the correct way is:

            expect(coder.is_partial?(v)).to eq(p), "expected #{v} for #{p}"
    

提交回复
热议问题