diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71646ca..345d22c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,3 +37,18 @@ jobs: run: bundle exec rspec - name: Run examples run: bundle exec ruby examples/feed.rb + - name: Report Coverage + uses: coverallsapp/github-action@v2 + with: + flag-name: run-${{ join(matrix.*, '-') }} + parallel: true + + upload-coverage: + needs: test + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Upload Code Coverage Report + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true diff --git a/.gitignore b/.gitignore index 4040c6c..1a27888 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .bundle Gemfile.lock pkg/* +coverage diff --git a/CHANGELOG.md b/CHANGELOG.md index a21cbe5..3ec7332 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * [#44](https://github.com/mongoid/mongoid-scroll/pull/44): Drop support for Mogoid 5 and Mongo Ruby Driver - [@dblock](https://github.com/dblock). * [#45](https://github.com/mongoid/mongoid-scroll/pull/45): Add support for Mogoid 9 - [@dblock](https://github.com/dblock). * [#46](https://github.com/mongoid/mongoid-scroll/pull/46): Upgrade RuboCop to 1.66.1 - [@dblock](https://github.com/dblock). +* [#47](https://github.com/mongoid/mongoid-scroll/pull/47): Add code coverage - [@dblock](https://github.com/dblock). * Your contribution here. ### 1.0.1 (2023/03/15) diff --git a/Gemfile b/Gemfile index 27204e2..bfc8b44 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,7 @@ end group :development, :test do gem 'bundler' + gem 'coveralls_reborn', require: false gem 'database_cleaner', '~> 1.8.5' gem 'faker' gem 'mongoid-danger', '~> 0.2.0', require: false diff --git a/README.md b/README.md index e1b7d71..64339d1 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ [![Gem Version](https://badge.fury.io/rb/mongoid-scroll.svg)](https://badge.fury.io/rb/mongoid-scroll) [![Build Status](https://github.com/mongoid/mongoid-scroll/actions/workflows/ci.yml/badge.svg)](https://github.com/mongoid/mongoid-scroll/actions/workflows/ci.yml) -[![Dependency Status](https://gemnasium.com/mongoid/mongoid-scroll.svg)](https://gemnasium.com/mongoid/mongoid-scroll) +[![Coverage Status](https://coveralls.io/repos/github/mongoid/mongoid-scroll/badge.svg?branch=master)](https://coveralls.io/github/mongoid/mongoid-scroll?branch=master) [![Code Climate](https://codeclimate.com/github/mongoid/mongoid-scroll.svg)](https://codeclimate.com/github/mongoid/mongoid-scroll) Mongoid extension that enables infinite scrolling for `Mongoid::Criteria` and `Mongo::Collection::View`. diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 797e782..cc6dfef 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,11 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) +require 'coveralls' +Coveralls.wear! do + add_filter 'spec' +end + require 'rubygems' require 'rspec' require 'rspec/its'