From f087f08061af16ed855440e0d006f436297fb28c Mon Sep 17 00:00:00 2001 From: Sonu Saha Date: Thu, 5 Sep 2024 01:28:57 +0530 Subject: [PATCH] spec: add code coverage & its workflow Signed-off-by: Sonu Saha --- .github/workflows/test.yml | 8 +++++++- Gemfile | 1 + spec/spec_helper.rb | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 22b3a09..43d5fda 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2 # Specify the Ruby version you're using + ruby-version: 3.2 bundler-cache: true # Cache the gems for faster builds - name: Install dependencies @@ -28,3 +28,9 @@ jobs: - name: Run tests run: bundle exec rspec + + - name: Upload coverage report + uses: actions/upload-artifact@v2 + with: + name: coverage-report + path: coverage/ diff --git a/Gemfile b/Gemfile index 35b4aa0..31c7011 100644 --- a/Gemfile +++ b/Gemfile @@ -16,5 +16,6 @@ group :development do end group :test do + gem 'simplecov' gem 'webmock', '~> 3.0' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5ca987e..863020e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,12 @@ # frozen_string_literal: true +require 'simplecov' +SimpleCov.start do + add_filter '/spec/' +end + +# require 'rspec' + require 'nse_data' require 'webmock/rspec'