Does an RSpec2 matcher for matching Hashes exist?

前端 未结 3 2260
渐次进展
渐次进展 2021-02-12 23:10

Note to future readers: think RSpec does not consider your Hashes equal? One might be an OrderedHash, but from the regular RSpec output you can\'t tell. This was the problem tha

3条回答
  •  不要未来只要你来
    2021-02-12 23:16

    Since 8 months the gem rspec-matchers has support for matching hashes:

    expected.should be_hash_matching(subhash_or_equal)
    

    see here for more details: https://github.com/rspec/rspec-expectations/pull/79

提交回复
热议问题