A template to avoid setting up and get started on testing and creating code.
Such as Xcode, Homebrew, RVM, Ruby, pry
- Go to
http://www.preparetocode.io/
- choose operating system
- click on xcode and follow instructions and download and install everything
Any other gems needed for the project, type in Gemfile
and at command line type bundle install
All stored in spec/
folder
Feature tests are done in spec/features/
folder
Naming of tests match the naming of scripts(ie example.rb
) that are tested, with _spec
added at the end (ie example_spec.rb
)
To require the file to be tested, at top of spec, type require <example>
Example of how tests are setup are given in spec/class_name_spec
Are stored in lib/
folder
To see coverage of tests, open coverage/.last_run.json
Run irb
or pry
(if installed) to access ruby console.
At command line run rspec
to run all tests (or whatever name the file is called)
To run individual tests rspec spec/class_name_spec.rb
(or whatever file wanted to test)
At command line run ruby class_name.rb
(or whatever name the file is called)