Tricks with RSpec components outside RSpec

10-Sep-2016 2956

What?

In this short post I’d like to show how some of RSpec components (matchers and expectations) can be used for a greater good outside your tests. Like in your normal everyday scripts.

Why?

Trying to be expressive, concise and readable, RSpec have developed a great number of idioms, mechanisms and approaches. They are reliable, most of Rubyists familiar with them, and code becames pretty expressive.

While I don’t recommend trying this at home using the tricks shown below in your Big Enterprise Production core, you may like those things for short scripts, experiments, insights, and just for fun.

Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle