07 February 2017
DESCRIPTION: RSpec is a testing GEM for Ruby, supposedly easier to read for non-developers.
Its documentation is located here:
$ gem install rspec
This gives you access to
$ rspec from the terminal.
To initialize in the project:
$ rspec --init
To install rspec into the current rails project:
$ rails g rspec:install
To add color and formatting to the rspec testing code:
$ rspec --color --format documentation and then the file path.
- or in the
.rspecfile put the formatting for color and format.
Run the command in the terminal
$ bundle exec rspec
- this will run every file with
_spec.rbnames in the
specfile by default. To change the test file to run at the end of the command write the path e.g.
$ bundle exec rspec spec/models/test.rb