Configuring RSpec
The following assumes that you've generated a middleman project using the its CLI middleman init your_project_name
Update your Gemfile
Add the following gems to your Gemfile
and run bundle install
Setup RSpec
From your terminal, navigate to your project directory and initialize RSpec config files for your project with the following command
rspec --init
Update the .rspec
file to have the following code
Then remove all content in spec/spec_helper.rb and replace with the following
With this in place we should now be ready to write our first spec
Feature specs
Most of the specs you'll be writing for a middleman app will be feature specs that test for certain things to be visible on the page. Below is a sample feature spec that checks if projects are listed on the index page
Last updated