Skip to content

Daily Archives: October 28th, 2008

Complex Hash Expectations in RSpec

When spec-ing something that calls method which takes a set of nested hashes (as many Rails methods do), it may be tempting to use #hash_including to test for only the values you care about. However #hash_including won’t work the way we might hope for nested hashes. Take the following (highly contrived) example:

describe CoffeeMaker […]