Alternatively you can checkout the RSpec yield matchers: https://www.relishapp.com/rspec/rspec-expectations/v/3-0/docs/built-in-matchers/yield-matchers