Read more

Test that a hash contains a partial hash with RSpec

Henning Koch
March 29, 2011Software engineer at makandra GmbH

To test whether a hash includes an expected sub-hash:

expect(user.attributes).to match(hash_including('name' => 'Bruce Wayne'))
expect(User).to receive(:create!).with(hash_including('name' => 'Bruce Wayne'))
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot
Posted by Henning Koch to makandra dev (2011-03-29 17:54)