diff --git a/.travis.yml b/.travis.yml index 7c536088e..795074687 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,14 +9,16 @@ before_script: - "psql -c 'create database registry_api_log_test;' -U postgres" - "cp config/application-example.yml config/application.yml" - "cp config/database-travis.yml config/database.yml" - - "RAILS_ENV=test bundle exec rake db:setup:all" + - "bundle exec rake db:setup:all" + - "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter" + - "chmod +x ./cc-test-reporter" + - "./cc-test-reporter before-build" script: - - "RAILS_ENV=test bundle exec rspec" + - "bundle exec rspec" - "bundle exec rake test" -after_success: - - "bundle exec codeclimate-test-reporter" +after_script: + - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT" services: - postgresql addons: postgresql: "9.4" - code_climate: diff --git a/Gemfile b/Gemfile index 1ec31ca48..ade4d256c 100644 --- a/Gemfile +++ b/Gemfile @@ -137,7 +137,6 @@ end group :test do gem 'database_cleaner' - gem 'codeclimate-test-reporter', "~> 1.0.0" - gem 'simplecov' + gem 'simplecov', require: false gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index e0ca04840..c7cddacca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,8 +142,6 @@ GEM xpath (~> 2.0) chronic (0.10.2) cliver (0.3.2) - codeclimate-test-reporter (1.0.8) - simplecov (<= 0.13) coderay (1.1.0) coercible (1.0.0) descendants_tracker (~> 0.0.1) @@ -413,11 +411,11 @@ GEM thor (~> 0.14) selectize-rails (0.12.1) sexp_processor (4.8.0) - simplecov (0.10.0) + simplecov (0.15.1) docile (~> 1.1.0) - json (~> 1.8) + json (>= 1.8, < 3) simplecov-html (~> 0.10.0) - simplecov-html (0.10.0) + simplecov-html (0.10.2) simpleidn (0.0.7) sinatra (1.4.8) rack (~> 1.5) @@ -488,7 +486,6 @@ DEPENDENCIES bundler-audit cancancan (= 1.11.0) capybara - codeclimate-test-reporter (~> 1.0.0) coderay (= 1.1.0) coffee-rails (= 4.1.0) countries diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 03ebbc9b3..3e1825acb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,11 +1,12 @@ +if ENV['COVERAGE'] + require 'simplecov' + SimpleCov.command_name 'spec' + SimpleCov.start 'rails' +end + require 'webmock/rspec' WebMock.disable_net_connect!(allow_localhost: true) -if ENV['TRAVIS'] - require 'simplecov' - SimpleCov.start -end - RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest diff --git a/test/test_helper.rb b/test/test_helper.rb index 58e45f58e..7bde0991d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,9 @@ +if ENV['COVERAGE'] + require 'simplecov' + SimpleCov.command_name 'test' + SimpleCov.start 'rails' +end + ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help'