Skip to content

Commit 31df80d

Browse files
committed
Setup test coverage with CodeClimate. (#47)
1 parent 481b5a3 commit 31df80d

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.travis.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,26 @@ language: ruby
22
sudo: false
33
before_install:
44
- bundle update
5+
env:
6+
global:
7+
- CC_TEST_REPORTER_ID=98c9b3070ea9ac0e8f7afb6570f181506c3a06372b1db5c7deb8e46089fdf132
8+
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
59
rvm:
610
- 2.2.2
711
- 2.3.3
812
- ruby-head
9-
1013
matrix:
1114
allow_failures:
1215
- rvm: ruby-head
16+
before_script:
17+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
18+
- chmod +x ./cc-test-reporter
19+
- ./cc-test-reporter before-build
20+
after_script:
21+
# Preferably you will run test-reporter on branch update events. But
22+
# if you setup travis to build PR updates only, you don't need to run
23+
# the line below
24+
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
25+
# In the case where travis is setup to build PR updates only,
26+
# uncomment the line below
27+
# - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT

jsonapi-rails.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
2121
spec.add_development_dependency 'sqlite3'
2222
spec.add_development_dependency 'rake', '~> 11.3'
2323
spec.add_development_dependency 'rspec-rails', '~> 3.5'
24+
spec.add_development_dependency 'simplecov'
2425
end

spec/rails_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
require 'simplecov'
2+
SimpleCov.start do
3+
add_filter '/spec/'
4+
end
5+
16
# This file is copied to spec/ when you run 'rails generate rspec:install'
27
ENV['RAILS_ENV'] ||= 'test'
38
require File.expand_path('../dummy/config/environment', __FILE__)

0 commit comments

Comments
 (0)