From 233aa666b1ab2d757b7b7e646dd6fb789b3d1eff Mon Sep 17 00:00:00 2001 From: LeFnord Date: Sun, 15 Jan 2017 13:59:16 +0100 Subject: [PATCH] adds code coverage w/ Coveralls - configure coveralls -adds changelog entry --- .gitignore | 1 + .travis.yml | 4 ++++ CHANGELOG.md | 1 + Gemfile | 1 + README.md | 1 + coveralls.yml | 1 + spec/spec_helper.rb | 11 +++++++++++ 7 files changed, 20 insertions(+) create mode 100644 coveralls.yml diff --git a/.gitignore b/.gitignore index 80edba87..c48d5228 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ ToDo.md spec/params_entity_spec.rb vendor/bundle/ spec/swagger_v2/x-dummy.rb +coverage/ diff --git a/.travis.yml b/.travis.yml index 7b6d80fb..46e82fe1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,13 @@ language: ruby sudo: false + before_install: - gem install bundler +after_success: + - coveralls + matrix: include: - rvm: 2.4.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 85226ea7..0e82e004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ #### Features * [#567](https://github.com/ruby-grape/grape-swagger/pull/567): Issue#566: removes markdown - [@LeFnord](https://github.com/LeFnord). +* [#568](https://github.com/ruby-grape/grape-swagger/pull/568): Adds code coverage w/ coveralls - [@LeFnord](https://github.com/LeFnord). * Your contribution here. diff --git a/Gemfile b/Gemfile index a8dc96a9..e47fb6ec 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ group :development, :test do gem 'rubocop', '~> 0.40' end group :test do + gem 'coveralls', require: false gem 'grape-entity' gem 'grape-swagger-entity' gem 'ruby-grape-danger', '~> 0.1.1', require: false diff --git a/README.md b/README.md index 91742d3b..55b106b0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Gem Version](https://badge.fury.io/rb/grape-swagger.svg)](http://badge.fury.io/rb/grape-swagger) [![Build Status](https://travis-ci.org/ruby-grape/grape-swagger.svg?branch=master)](https://travis-ci.org/ruby-grape/grape-swagger) +[![Coverage Status](https://coveralls.io/repos/github/ruby-grape/grape-swagger/badge.svg)](https://coveralls.io/github/ruby-grape/grape-swagger) [![Dependency Status](https://gemnasium.com/ruby-grape/grape-swagger.svg)](https://gemnasium.com/ruby-grape/grape-swagger) [![Code Climate](https://codeclimate.com/github/ruby-grape/grape-swagger.svg)](https://codeclimate.com/github/ruby-grape/grape-swagger) diff --git a/coveralls.yml b/coveralls.yml new file mode 100644 index 00000000..91600595 --- /dev/null +++ b/coveralls.yml @@ -0,0 +1 @@ +service_name: travis-ci diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index be1acabb..e4a35bbc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,20 @@ +require 'simplecov' +require 'coveralls' + +SimpleCov.start do + add_filter 'spec/' + add_filter 'example/' +end + +Coveralls.wear! + $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) MODEL_PARSER = ENV.key?('MODEL_PARSER') ? ENV['MODEL_PARSER'].to_s.downcase.sub('grape-swagger-', '') : 'mock' require 'grape' require 'grape-swagger' + Dir[File.join(Dir.getwd, 'spec/support/*.rb')].each { |f| require f } require "grape-swagger/#{MODEL_PARSER}" if MODEL_PARSER != 'mock' require File.join(Dir.getwd, "spec/support/model_parsers/#{MODEL_PARSER}_parser.rb")