We’re going to start with a technique you’ve already used to keep your code organized: helper methods. RSpec provides its own matchers via built-in methods, such as contain_exactly(...). You can easily write your own methods that return the same matcher objects but using names specific to your domain. You can also add your own customizations, such as default arguments.
When you developed the expense tracker application in Part 2, Building an App With RSpec 3, you used the matcher expression a_hash_including(id: some_id) to represent a particular expected expense. Here’s an example use: