O'Reilly logo

RSpec Essentials by Mani Tadayon

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

Configuring RSpec to run a feature file

Let's have a look now at spec/feature_helper.rb, which will load all of the setup code, helpers, and custom matchers. This is what that file contains:

require_relative 'config/common'
require_relative 'config/capybara'
require_relative 'helpers/web_input_helpers'
require_relative 'helpers/custom_matchers'

It's just a little wrapper that pulls in four different files. We've kept everything nice and clean by using separate files for each concern. This will help keep our RSpec code maintainable and will make it easier to follow changes as our feature evolves over the course of this and the following chapter.

We have first a little file called spec/config/capybara.rb with some basic RSpec configuration:

RSpec.configure ...

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