O'Reilly logo

Effective Testing with RSpec 3 by Myron Marston, Ian Dees

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Installing RSpec

First, to use RSpec 3, you need a recent version of Ruby. We’ve tested our examples in this book with Ruby 2.4, and encourage you to use that version for the easiest path. You may get slightly different results on other versions of Ruby. If you’re using something older, go to the Ruby download page and grab a newer one.[9]

RSpec is made of three independent Ruby gems:

  • rspec-core is the overall test harness that runs your specs.

  • rspec-expectations provides a readable, powerful syntax for checking properties of your code.

  • rspec-mocks makes it easy to isolate the code you’re testing from the rest of the system.

You can install these individually and mix them with other test frameworks, assertion libraries, and mocking tools. But ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required