- Run
gem install rspec
to install the RSpec gem globally - Create an spec folder
- Configure RSpec:
require 'rspec'
# load root location rb classes to test
Dir['./*.rb'].sort.each { |file| require file }
# load /app folder rb classes to test
Dir['./app/**/*.rb'].sort.each { |file| require file }
RSpec.configure do |config|
# add extra configuration here
end
- create new specs on spec folder remember to add
require 'spec_helper'
at the beginning of the class - run from the root folder
rspec spec -f d