Skip to content

Commit 0f83fda

Browse files
committed
generate test coverage
1 parent 1b21a5a commit 0f83fda

File tree

8 files changed

+141
-1
lines changed

8 files changed

+141
-1
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,27 @@ jobs:
3838
bundler-cache: true
3939
rubygems: latest
4040
- name: Run specs
41-
run: bundle exec rake spec
41+
run: COVERAGE=true bundle exec rake spec
42+
- name: Upload Coverage Artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: coverage-ubuntu-${{ matrix.ruby }}
46+
path: coverage/coverage.json
47+
if-no-files-found: error
48+
upload_coverage:
49+
name: Upload Coverage
50+
needs: test
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- uses: actions/download-artifact@v4
55+
name: Download Coverage Artifacts
56+
with:
57+
pattern: coverage-*
58+
- uses: paambaati/codeclimate-action@v9
59+
env:
60+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
61+
if: ${{ env.CC_TEST_REPORTER_ID != '' }}
62+
with:
63+
coverageLocations: |
64+
${{github.workspace}}/coverage-*/coverage.json:simplecov

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--require spec_helper

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ gem 'rake'
1010
gem 'rspec'
1111
gem 'rubocop', require: false
1212
gem 'rubocop-performance', require: false
13+
gem 'simplecov', require: false, group: :test
1314
gem 'webmock'

Gemfile.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ GEM
9999
crass (1.0.6)
100100
date (3.3.4)
101101
diff-lcs (1.5.1)
102+
docile (1.4.1)
102103
drb (2.2.0)
103104
ruby2_keywords
104105
erubi (1.12.0)
@@ -231,6 +232,12 @@ GEM
231232
rubocop-ast (>= 1.30.0, < 2.0)
232233
ruby-progressbar (1.13.0)
233234
ruby2_keywords (0.0.5)
235+
simplecov (0.22.0)
236+
docile (~> 1.1)
237+
simplecov-html (~> 0.11)
238+
simplecov_json_formatter (~> 0.1)
239+
simplecov-html (0.13.1)
240+
simplecov_json_formatter (0.1.4)
234241
stringio (3.1.0)
235242
thor (1.3.0)
236243
timeout (0.4.1)
@@ -262,6 +269,7 @@ DEPENDENCIES
262269
rspec
263270
rubocop
264271
rubocop-performance
272+
simplecov
265273
treblle!
266274
webmock
267275

spec/lib/middleware_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'rspec'
24
require 'treblle/middleware'
35
require 'treblle/configuration'

spec/lib/rails/railtie_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
require 'rspec'
14
require 'rails'
25
require 'treblle/rails/railtie'
36

spec/lib/response_builder_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'rspec'
24
require 'treblle/response_builder'
35

spec/spec_helper.rb

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# This file was generated by the `rspec --init` command. Conventionally, all
2+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3+
# The generated `.rspec` file contains `--require spec_helper` which will cause
4+
# this file to always be loaded, without a need to explicitly require it in any
5+
# files.
6+
#
7+
# Given that it is always loaded, you are encouraged to keep this file as
8+
# light-weight as possible. Requiring heavyweight dependencies from this file
9+
# will add to the boot time of your test suite on EVERY test run, even for an
10+
# individual file that may not need all of that loaded. Instead, consider making
11+
# a separate helper file that requires the additional dependencies and performs
12+
# the additional setup, and require it from the spec files that actually need
13+
# it.
14+
#
15+
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16+
17+
require 'simplecov'
18+
SimpleCov.start
19+
20+
RSpec.configure do |config|
21+
# rspec-expectations config goes here. You can use an alternate
22+
# assertion/expectation library such as wrong or the stdlib/minitest
23+
# assertions if you prefer.
24+
config.expect_with :rspec do |expectations|
25+
# This option will default to `true` in RSpec 4. It makes the `description`
26+
# and `failure_message` of custom matchers include text for helper methods
27+
# defined using `chain`, e.g.:
28+
# be_bigger_than(2).and_smaller_than(4).description
29+
# # => "be bigger than 2 and smaller than 4"
30+
# ...rather than:
31+
# # => "be bigger than 2"
32+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
33+
end
34+
35+
# rspec-mocks config goes here. You can use an alternate test double
36+
# library (such as bogus or mocha) by changing the `mock_with` option here.
37+
config.mock_with :rspec do |mocks|
38+
# Prevents you from mocking or stubbing a method that does not exist on
39+
# a real object. This is generally recommended, and will default to
40+
# `true` in RSpec 4.
41+
mocks.verify_partial_doubles = true
42+
end
43+
44+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
45+
# have no way to turn it off -- the option exists only for backwards
46+
# compatibility in RSpec 3). It causes shared context metadata to be
47+
# inherited by the metadata hash of host groups and examples, rather than
48+
# triggering implicit auto-inclusion in groups with matching metadata.
49+
config.shared_context_metadata_behavior = :apply_to_host_groups
50+
51+
# The settings below are suggested to provide a good initial experience
52+
# with RSpec, but feel free to customize to your heart's content.
53+
# # This allows you to limit a spec run to individual examples or groups
54+
# # you care about by tagging them with `:focus` metadata. When nothing
55+
# # is tagged with `:focus`, all examples get run. RSpec also provides
56+
# # aliases for `it`, `describe`, and `context` that include `:focus`
57+
# # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
58+
# config.filter_run_when_matching :focus
59+
#
60+
# # Allows RSpec to persist some state between runs in order to support
61+
# # the `--only-failures` and `--next-failure` CLI options. We recommend
62+
# # you configure your source control system to ignore this file.
63+
# config.example_status_persistence_file_path = "spec/examples.txt"
64+
#
65+
# # Limits the available syntax to the non-monkey patched syntax that is
66+
# # recommended. For more details, see:
67+
# # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
68+
# config.disable_monkey_patching!
69+
#
70+
# # This setting enables warnings. It's recommended, but in some cases may
71+
# # be too noisy due to issues in dependencies.
72+
# config.warnings = true
73+
#
74+
# # Many RSpec users commonly either run the entire suite or an individual
75+
# # file, and it's useful to allow more verbose output when running an
76+
# # individual spec file.
77+
# if config.files_to_run.one?
78+
# # Use the documentation formatter for detailed output,
79+
# # unless a formatter has already been configured
80+
# # (e.g. via a command-line flag).
81+
# config.default_formatter = "doc"
82+
# end
83+
#
84+
# # Print the 10 slowest examples and example groups at the
85+
# # end of the spec run, to help surface which specs are running
86+
# # particularly slow.
87+
# config.profile_examples = 10
88+
#
89+
# # Run specs in random order to surface order dependencies. If you find an
90+
# # order dependency and want to debug it, you can fix the order by providing
91+
# # the seed, which is printed after each run.
92+
# # --seed 1234
93+
# config.order = :random
94+
#
95+
# # Seed global randomization in this process using the `--seed` CLI option.
96+
# # Setting this allows you to use `--seed` to deterministically reproduce
97+
# # test failures related to randomization by passing the same `--seed` value
98+
# # as the one that triggered the failure.
99+
# Kernel.srand config.seed
100+
end

0 commit comments

Comments
 (0)