RubyFlow The Ruby and Rails community linklog

Custom RSpec matchers for blocks, and the Ruby magic behind their inner workings

In RSpec it is possible to define special custom matchers that enable us to test, with a neat syntax, what happens when some code is executed, while also helping reduce duplication.

This blog post shows how to define such matchers and how they work behind the scenes thanks to Ruby’s magic.

Custom RSpec matchers for blocks, and the Ruby magic behind their inner workings

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in