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'))
Posted by Henning Koch to makandra dev (2011-03-29 15:54)