Add Test Coverage, Code Quality, and Code Style checks - NikitaDouglas/acebook-Kindred GitHub Wiki
This page lists the actions we took to set all the testing frameworks, code quality gems and style checks for Kindred linked to this Git Issue: [GitHub Issue #2](Test Coverage, Code Quality, Code Style).
Learnt:
- Gems for testings need to be in the :test, :development group but also just :test group.
- Gems used globally should be outside these groups:
gem 'rails', '~> 5.1.1'
# Use postgresql as the database for Active Record
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
group :development, :test do
gem 'byebug', platforms: %i[mri mingw x64_mingw]
gem 'capybara', '~> 2.13'
gem 'rspec-rails', '~> 3.5'
gem 'selenium-webdriver'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'web-console', '>= 3.3.0'
end
group :test do
gem 'simplecov', require: false
gem 'simplecov-console', require: false
# gem 'simplecov-html', require: false
end
CodeClimate
CodeClimate gives an overview of all your tests and snippets. Repo owner needs to enable team access
https://codeclimate.com/github/NikitaDouglas/acebook-Kindred
Rubocop
- Create
rubocop.ymlin top level of project directory. Add the following at top of file to stop:
Documentation:
Enabled: false
Run these following order to see offences, -x auto corrects all linting and justification, -a autocorrects all. Errors need to be 0 to get travis to deploy!
rubocop
rubocop -x
rubocop -a
SimpleCov
- the following files have been excluded from simpleCov test coverage stats in the spec_helper.rb to achieve 100% coverage. If we make any modifications to the files we will need to add them back in.
app/jobs/application_job.rb
app/mailers/application_mailer.rb
app/channels/application_cable/connection.rb
app/channels/application_cable/channel.rb