Skip to content

Commit

Permalink
Fix repo coverage (#2467)
Browse files Browse the repository at this point in the history
* simplecov libraries are now require false
simplecov required at top of spec_helper.rb
Use simplecov configuration file
lcov will be used only on CI, default is a html
remove duplicate warnings in spec_helper
remove some $LOAD_PATH.unshift( at top of spec_helper

* Add changelog
  • Loading branch information
ericproulx authored Jun 29, 2024
1 parent 987b9f9 commit b47d9ad
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
15 changes: 15 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

if ENV['GITHUB_USER'] # only when running CI
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = 'coverage/lcov.info'
end

SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
end

SimpleCov.start do
add_filter '/spec/'
end
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#### Fixes

* [#2467](https://github.com/ruby-grape/grape/pull/2467): Fix repo coverage - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

### 2.1.2 (2024-06-28)
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ group :test do
gem 'rack-test', '~> 2.1'
gem 'rspec', '~> 3.13'
gem 'ruby-grape-danger', '~> 0.2', require: false
gem 'simplecov', '~> 0.21'
gem 'simplecov-lcov', '~> 0.8'
gem 'simplecov', '~> 0.21', require: false
gem 'simplecov-lcov', '~> 0.8', require: false
gem 'test-prof', require: false
end

Expand Down
18 changes: 1 addition & 17 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# frozen_string_literal: true

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'support'))

require 'simplecov'
require 'rubygems'
require 'bundler'
Bundler.require :default, :test

require 'grape'

Grape.deprecator.behavior = :raise

%w[config support].each do |dir|
Expand All @@ -27,21 +22,10 @@
config.include Spec::Support::Helpers
config.raise_errors_for_deprecations!
config.filter_run_when_matching :focus
config.warnings = true

config.before(:all) { Grape::Util::InheritableSetting.reset_global! }
config.before { Grape::Util::InheritableSetting.reset_global! }

# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
end

require 'simplecov'
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = 'coverage/lcov.info'
end

SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
SimpleCov.start

0 comments on commit b47d9ad

Please sign in to comment.