simplecov-small-badge 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6048aaf73aefa7123e7064fb5d4a1f8d8f7b15ada66e68e9c4b04dc922249596
4
- data.tar.gz: f2012634daa14fd29c91221211a7e71b1680d8baef390289a8e1a016f0fcfcaa
3
+ metadata.gz: 34ccd3dc87dabd91e2dc8dee7c1ac68ccc1cc5398f2c903d26681ba94d056e77
4
+ data.tar.gz: 5581f6ad5c1c7264e383f2ee8c3b458b51e0baf595c9efa39fb0707e803a8140
5
5
  SHA512:
6
- metadata.gz: 2ef19e4bbeee19da9a1250ab8744b158cb10f89e29ff9b0b32b5ca0277b5d84bdbae2b91063d3d23832dd32c4b482b9d619c1068b7bd4c4f43526fc7d26ca8ba
7
- data.tar.gz: b1a731b794f74efc8003383941db851c17cb1ef3b39dca3ce9e8b73624b3b9bd53ae360cdc3e059c0b5537cbd15ed050a7db02b5d00e943ab8bc34471033ba21
6
+ metadata.gz: bdc8724ef0ddc8ce79947ed4c78ef25c85ec1fd110e47896c842f856674e5565cea89fd128e11f0905e1a0ceb68f3a4a8750cc008fd1833377c95847f2ec10ec
7
+ data.tar.gz: 4ade1524010c0b9445036750a8ffa0959e95dae425844092b9836fd29124ca619465392f74399b9bd5765a26d50e76a7eff41b5290391d9164f418f4ca07a35c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.3
1
+ 3.2.2
data/.travis.yml CHANGED
@@ -3,7 +3,7 @@ branches:
3
3
  only:
4
4
  - master
5
5
  rvm:
6
- - 2.5.3
6
+ - 3.2.2
7
7
  cache: bundler
8
8
  bundler_args: "--jobs=3 --retry=3 --without production"
9
9
  matrix:
@@ -34,7 +34,7 @@ module SimpleCovSmallBadge
34
34
  # rubocop:enable Metrics/MethodLength
35
35
 
36
36
  # set up class variables and getters/setters
37
- options.keys.each do |opt|
37
+ options.each_key do |opt|
38
38
  define_method(opt) { instance_variable_get "@#{opt}" }
39
39
  define_method("#{opt}=") { |val| instance_variable_set("@#{opt}", val) }
40
40
  end
@@ -7,7 +7,7 @@ module SimpleCovSmallBadge
7
7
  # Basic Badge Formater Class that creates the badges.
8
8
  class Formatter
9
9
  def initialize(output = nil)
10
- @output = output || STDOUT
10
+ @output = output || $stdout
11
11
  @config = SimpleCovSmallBadge.config
12
12
  end
13
13
 
@@ -33,8 +33,8 @@ module SimpleCovSmallBadge
33
33
  end
34
34
 
35
35
  def state(covered_percent)
36
- if SimpleCov.minimum_coverage&.positive?
37
- if covered_percent >= SimpleCov.minimum_coverage
36
+ if line_coverage_minimum&.positive?
37
+ if covered_percent >= line_coverage_minimum
38
38
  'good'
39
39
  else
40
40
  'bad'
@@ -44,6 +44,11 @@ module SimpleCovSmallBadge
44
44
  end
45
45
  end
46
46
 
47
+ def line_coverage_minimum
48
+ minimums = SimpleCov.minimum_coverage
49
+ minimums.is_a?(Hash) ? minimums[:line] : minimums
50
+ end
51
+
47
52
  def map_image_config(state)
48
53
  hash = {}
49
54
  @config.to_hash.map do |key, value|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleCovSmallBadge
4
- VERSION = '0.2.4'
4
+ VERSION = '0.2.5'
5
5
  end
@@ -4,6 +4,7 @@ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
4
  require 'simplecov_small_badge/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
+ s.required_ruby_version = '>=3.2'
7
8
  s.name = 'simplecov-small-badge'
8
9
  s.version = SimpleCovSmallBadge::VERSION
9
10
  s.platform = Gem::Platform::RUBY
@@ -15,11 +16,11 @@ Gem::Specification.new do |s|
15
16
 
16
17
  s.rubyforge_project = 'simplecov-small-badge'
17
18
 
18
- s.add_dependency 'repo-small-badge', '~> 0.2.7'
19
- s.add_dependency 'simplecov', '~> 0.17'
20
- s.add_development_dependency 'rake', '~> 12'
19
+ s.add_dependency 'repo-small-badge', '~> 0.2.10'
20
+ s.add_dependency 'simplecov', '~> 0.18'
21
+ s.add_development_dependency 'rake', '~> 13'
21
22
  s.add_development_dependency 'rspec', '~> 3.8'
22
- s.add_development_dependency 'rubocop', '~> 0.65'
23
+ s.add_development_dependency 'rubocop', '~> 1.0'
23
24
  s.add_development_dependency 'rubycritic', '~> 4.1'
24
25
  s.add_development_dependency 'rubycritic-small-badge', '~> 0.2'
25
26
 
@@ -13,6 +13,13 @@ describe SimpleCovSmallBadge::Formatter do
13
13
  result = mock_result(50)
14
14
  expect(subject.format(result)).to be_truthy
15
15
  end
16
+
17
+ it do
18
+ allow(SimpleCov).to receive(:minimum_coverage).and_return(line: 90)
19
+ mock_repo_badge_image(cov: '50%', state: 'bad')
20
+ result = mock_result(50)
21
+ expect(subject.format(result)).to be_truthy
22
+ end
16
23
  end
17
24
 
18
25
  context 'good result' do
@@ -35,6 +42,26 @@ describe SimpleCovSmallBadge::Formatter do
35
42
  result = mock_result(90, 'library' => mock_result_group(90))
36
43
  expect(subject.format(result)).to be_truthy
37
44
  end
45
+
46
+ it do
47
+ allow(SimpleCov).to receive(:minimum_coverage).and_return(line: 100)
48
+ image_mock = mock_repo_badge_image(title: 'total', name: 'total',
49
+ cov: '100%')
50
+ mock_repo_badge_image(title: 'library', name: 'library',
51
+ cov: '100%', mock: image_mock)
52
+ result = mock_result(100, 'library' => mock_result_group(100))
53
+ expect(subject.format(result)).to be_truthy
54
+ end
55
+
56
+ it do
57
+ allow(SimpleCov).to receive(:minimum_coverage).and_return(line: 90)
58
+ image_mock = mock_repo_badge_image(title: 'total', name: 'total',
59
+ cov: '90%')
60
+ mock_repo_badge_image(title: 'library', name: 'library',
61
+ cov: '90%', mock: image_mock)
62
+ result = mock_result(90, 'library' => mock_result_group(90))
63
+ expect(subject.format(result)).to be_truthy
64
+ end
38
65
  end
39
66
 
40
67
  context 'bad result' do
@@ -47,6 +74,16 @@ describe SimpleCovSmallBadge::Formatter do
47
74
  result = mock_result(90, 'library' => mock_result_group(90))
48
75
  expect(subject.format(result)).to be_truthy
49
76
  end
77
+
78
+ it do
79
+ allow(SimpleCov).to receive(:minimum_coverage).and_return(line: 91)
80
+ image_mock = mock_repo_badge_image(title: 'total', name: 'total',
81
+ cov: '90%', state: 'bad')
82
+ mock_repo_badge_image(title: 'library', name: 'library',
83
+ cov: '90%', state: 'bad', mock: image_mock)
84
+ result = mock_result(90, 'library' => mock_result_group(90))
85
+ expect(subject.format(result)).to be_truthy
86
+ end
50
87
  end
51
88
 
52
89
  context 'unknown result' do
@@ -59,6 +96,16 @@ describe SimpleCovSmallBadge::Formatter do
59
96
  result = mock_result(90, 'library' => mock_result_group(90))
60
97
  expect(subject.format(result)).to be_truthy
61
98
  end
99
+
100
+ it do
101
+ allow(SimpleCov).to receive(:minimum_coverage).and_return({})
102
+ image_mock = mock_repo_badge_image(title: 'total', name: 'total',
103
+ cov: '90%', state: 'unknown')
104
+ mock_repo_badge_image(title: 'library', name: 'library',
105
+ cov: '90%', state: 'unknown', mock: image_mock)
106
+ result = mock_result(90, 'library' => mock_result_group(90))
107
+ expect(subject.format(result)).to be_truthy
108
+ end
62
109
  end
63
110
 
64
111
  context 'mixed result' do
@@ -71,6 +118,16 @@ describe SimpleCovSmallBadge::Formatter do
71
118
  result = mock_result(89, 'library' => mock_result_group(90))
72
119
  expect(subject.format(result)).to be_truthy
73
120
  end
121
+
122
+ it do
123
+ allow(SimpleCov).to receive(:minimum_coverage).and_return(line: 90)
124
+ image_mock = mock_repo_badge_image(title: 'total', name: 'total',
125
+ cov: '89%', state: 'bad')
126
+ mock_repo_badge_image(title: 'library', name: 'library',
127
+ cov: '90%', state: 'good', mock: image_mock)
128
+ result = mock_result(89, 'library' => mock_result_group(90))
129
+ expect(subject.format(result)).to be_truthy
130
+ end
74
131
  end
75
132
  end
76
133
  end
data/spec/spec_helper.rb CHANGED
@@ -3,12 +3,12 @@
3
3
  require 'simplecov'
4
4
  require 'byebug'
5
5
 
6
- SimpleCov.start do
7
- module SimpleCovSmallBadge
8
- class Formatter
9
- end
6
+ module SimpleCovSmallBadge
7
+ class Formatter
10
8
  end
9
+ end
11
10
 
11
+ SimpleCov.start do
12
12
  SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
13
13
  [
14
14
  SimpleCov::Formatter::HTMLFormatter,
@@ -23,7 +23,7 @@ require 'simplecov_small_badge'
23
23
  require 'rubygems'
24
24
  require 'bundler/setup'
25
25
 
26
- Dir[File.join('./spec/support/*.rb')].each { |f| require f }
26
+ Dir[File.join('./spec/support/*.rb')].sort.each { |f| require f }
27
27
 
28
28
  SimpleCovSmallBadge.configure do |config|
29
29
  # config.rounded_border = false
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TestSimpleCovSmallBadge
4
4
  module Mocks
5
- # rubocop:disable Metrics/ParameterLists, Metrics/AbcSize
5
+ # rubocop:disable Metrics/ParameterLists
6
6
  def mock_repo_badge_image(cov: 100, name: 'total',
7
7
  title: 'total',
8
8
  state: 'good',
@@ -15,7 +15,7 @@ module TestSimpleCovSmallBadge
15
15
  allow(mock).to receive(:badge).with(name, title, cov)
16
16
  mock
17
17
  end
18
- # rubocop:enable Metrics/ParameterLists, Metrics/AbcSize
18
+ # rubocop:enable Metrics/ParameterLists
19
19
 
20
20
  def map_config_options(config_hash, state)
21
21
  hash = {}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov-small-badge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Grimme
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-30 00:00:00.000000000 Z
11
+ date: 2023-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: repo-small-badge
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.7
19
+ version: 0.2.10
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.7
26
+ version: 0.2.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: simplecov
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.17'
33
+ version: '0.18'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.17'
40
+ version: '0.18'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '12'
47
+ version: '13'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '12'
54
+ version: '13'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.65'
75
+ version: '1.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.65'
82
+ version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubycritic
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -151,15 +151,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - ">="
153
153
  - !ruby/object:Gem::Version
154
- version: '0'
154
+ version: '3.2'
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
- rubyforge_project: simplecov-small-badge
162
- rubygems_version: 2.7.8
161
+ rubygems_version: 3.4.10
163
162
  signing_key:
164
163
  specification_version: 4
165
164
  summary: Small Badge generator for SimpleCov coverage tool for ruby