simplecov-shield-json 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simplecov-shield-json/version.rb +1 -1
- data/spec/lib/simplecov_shield_json_spec.rb +36 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4ae7844bac6556edaf7ad55d133aa73c7965acb9b43f57a083217688dfca11d
|
4
|
+
data.tar.gz: b61e4964ffd48ed08bcbbd538dc2e0731000125265b89e0bfbddba44ce72dc5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e62cee88e3a0b2282db85c42b7873ac3ed882909dd926de9d1f51749c7e8aaca71400c2ffcca5838ae8eee6eae9cc5a8d153b896af4771cd543f85fa626d4fe3
|
7
|
+
data.tar.gz: c5daca06b0d90819da609c8c8f4d8429e847657984c5f1864402ff9a267ed86ae477fa4b9062b2e2b3f44e991bc5000488ef6c1b3613616ceaa09b04cde39bb4
|
@@ -3,8 +3,44 @@
|
|
3
3
|
require File.expand_path('../../lib/simplecov-shield-json', __dir__)
|
4
4
|
require File.expand_path('../spec_helper', __dir__)
|
5
5
|
|
6
|
+
# rubocop:disable Metrics/BlockLength
|
6
7
|
describe SimpleCov::Formatter::ShieldJSONFormatter do
|
8
|
+
shared_examples 'percentage color' do |percentage, color|
|
9
|
+
context 'generating report' do
|
10
|
+
before do
|
11
|
+
allow(simplecov_result).to receive(:covered_percent).and_return(percentage)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "with #{percentage} should return #{color}" do
|
15
|
+
expect(described_class.new.format(simplecov_result)).to eq(
|
16
|
+
{
|
17
|
+
'schemaVersion': 1,
|
18
|
+
'label': 'Coverage',
|
19
|
+
'message': "#{percentage}%",
|
20
|
+
'color': color,
|
21
|
+
'cacheSeconds': 1800
|
22
|
+
}.to_json
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
7
28
|
it 'should be a class' do
|
8
29
|
expect(described_class.new).to be_a SimpleCov::Formatter::ShieldJSONFormatter
|
9
30
|
end
|
31
|
+
|
32
|
+
context '#format' do
|
33
|
+
let(:simplecov_result) { double('SimpleCov::Result') }
|
34
|
+
|
35
|
+
before do
|
36
|
+
allow(simplecov_result).to receive(:command_name).and_return('RSpec')
|
37
|
+
allow(simplecov_result).to receive(:covered_lines).and_return(3214)
|
38
|
+
allow(simplecov_result).to receive(:total_lines).and_return(2714)
|
39
|
+
end
|
40
|
+
|
41
|
+
it_behaves_like 'percentage color', 90.12, 'brightgreen'
|
42
|
+
it_behaves_like 'percentage color', 83.09, 'yellow'
|
43
|
+
it_behaves_like 'percentage color', 51.98, 'red'
|
44
|
+
end
|
10
45
|
end
|
46
|
+
# rubocop:enable Metrics/BlockLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-shield-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Pereira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|