simplecov-oj 0.18.0 → 0.18.2

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: 2a5cb1f33b1f2da7cf91879ec6ab44c70ea9d3069a1d67bc7953426da1c06489
4
- data.tar.gz: 64abb42d0f448f50854ab31fc41b004122c41c4e3ea5b1379aaf1ceb1e503fc8
3
+ metadata.gz: fb418a561162036e2741a76baef6dba8ab9339c915970f32428232127e0dce86
4
+ data.tar.gz: 798f34594159560b6f64fd0f69b799c2a428add53275e88d292622244ccf3433
5
5
  SHA512:
6
- metadata.gz: 266222bbef8d53d90d3eb6f9d8b1fa352b7ecd542180e37f509e87c783197a1ea130d3135a92947c2c991d579240346b0869814ebe7442c9efbdd81c7bf3ef72
7
- data.tar.gz: 4afe0864271389a015292f944035bc354e1be3d64ed4a105c4f221a8119c1f0362d95c5c464af5b73b1b7155beac92e008f5f9f3a52549a1f5b013d48f8088eb
6
+ metadata.gz: 13a883c1bc3c5e070262350b838a6ba9ef777b6e4b67b6549a1b63d1c2a8e6b1ea7c507391e9150f5b86a1863f8fed31b2444e0bae5c09a8ba591d3b980feec1
7
+ data.tar.gz: 3c028c0280f7eba299e0ffc2d3143c4fb415d00ea7e09a1bb223684d2bcbd4b3a9e4f23d7a6aaed331f3207b3312cf20b9f4316069629bef4140f7ffd956fb29
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.18.0](https://github.com/mhenrixon/simplecov-oj/tree/v0.18.0) (2020-01-29)
4
+
5
+ [Full Changelog](https://github.com/mhenrixon/simplecov-oj/compare/v0.2...v0.18.0)
6
+
3
7
  ## [v0.2](https://github.com/mhenrixon/simplecov-oj/tree/v0.2) (2013-07-20)
4
8
 
5
9
  [Full Changelog](https://github.com/mhenrixon/simplecov-oj/compare/aa3f4993ad39ba63229938d23ac2470b6f2cee3e...v0.2)
@@ -12,7 +12,7 @@ module SimpleCov
12
12
  class OjFormatter
13
13
  #
14
14
  # @return [String] name of the file with coverage.json data
15
- FILE_NAME = "coverage.json"
15
+ FILE_NAME = 'coverage.json'
16
16
 
17
17
  #
18
18
  # Formats the result as a hash, dump it to json with Oj and then save it to disk
@@ -35,7 +35,7 @@ module SimpleCov
35
35
  data = SimpleCov::Oj::ResultToHash.new(result).to_h
36
36
  json = ::Oj.dump(data, mode: :compat)
37
37
 
38
- File.open(output_filepath, "w+") do |file|
38
+ File.open(output_filepath, 'w+') do |file|
39
39
  file.puts json
40
40
  end
41
41
 
@@ -26,7 +26,7 @@ module SimpleCov
26
26
  # @return [String]
27
27
  #
28
28
  def to_s
29
- "Coverage report generated" \
29
+ 'Coverage report generated' \
30
30
  " for #{command_name}" \
31
31
  " to #{output_filepath}." \
32
32
  " #{covered_lines} / #{total_lines} LOC (#{covered_percent.round(2)}%) covered."
@@ -18,7 +18,7 @@ module SimpleCov
18
18
  @data = {
19
19
  timestamp: result.created_at.to_i,
20
20
  command_name: result.command_name,
21
- files: [],
21
+ files: []
22
22
  }
23
23
  end
24
24
 
@@ -29,7 +29,7 @@ module SimpleCov
29
29
  covered_percent: covered_percent,
30
30
  covered_strength: covered_strength,
31
31
  covered_lines: covered_lines,
32
- total_lines: total_lines,
32
+ total_lines: total_lines
33
33
  }
34
34
  end
35
35
 
@@ -9,6 +9,6 @@ module SimpleCov
9
9
  module Oj
10
10
  #
11
11
  # @return [String] the current version of the gem
12
- VERSION = "0.18.0"
12
+ VERSION = '0.18.2'
13
13
  end
14
14
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "simplecov"
4
- require "oj"
3
+ require 'simplecov'
4
+ require 'oj'
5
5
 
6
- require "simple_cov/oj/result_wrapper"
7
- require "simple_cov/oj/source_file_wrapper"
8
- require "simple_cov/oj/result_to_hash"
9
- require "simple_cov/oj/result_to_hash"
10
- require "simple_cov/oj/output_message"
11
- require "simple_cov/oj/version"
12
- require "simple_cov/formatter/oj_formatter"
6
+ require 'simple_cov/oj/result_wrapper'
7
+ require 'simple_cov/oj/source_file_wrapper'
8
+ require 'simple_cov/oj/result_to_hash'
9
+ require 'simple_cov/oj/result_to_hash'
10
+ require 'simple_cov/oj/output_message'
11
+ require 'simple_cov/oj/version'
12
+ require 'simple_cov/formatter/oj_formatter'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- desc "Generate a Changelog"
3
+ desc 'Generate a Changelog'
4
4
  task :changelog do
5
5
  # rubocop:disable Style/MutableConstant
6
6
  CHANGELOG_CMD ||= %w[
@@ -13,12 +13,12 @@ task :changelog do
13
13
  simplecov-oj
14
14
  --token
15
15
  ]
16
- ADD_CHANGELOG_CMD ||= "git add --all"
17
- COMMIT_CHANGELOG_CMD ||= "git commit -a -m 'Update changelog'"
16
+ ADD_CHANGELOG_CMD ||= 'git add --all'
17
+ COMMIT_CHANGELOG_CMD ||= "git commit -a -m 'Update changelog'"
18
18
  # rubocop:enable Style/MutableConstant
19
19
 
20
- sh("git checkout master")
21
- sh(*CHANGELOG_CMD.push(ENV["CHANGELOG_GITHUB_TOKEN"]))
20
+ sh('git checkout master')
21
+ sh(*CHANGELOG_CMD.push(ENV['CHANGELOG_GITHUB_TOKEN']))
22
22
  sh(ADD_CHANGELOG_CMD)
23
23
  sh(COMMIT_CHANGELOG_CMD)
24
24
  end
@@ -3,16 +3,43 @@
3
3
  RSpec.describe SimpleCov::Formatter::OjFormatter do
4
4
  let(:formatter) { described_class.new }
5
5
  let(:result) { instance_double(SimpleCov::Result) }
6
- let(:command_name) { "RSpec" }
6
+ let(:command_name) { 'RSpec' }
7
7
  let(:created_at) { Time.now.to_s }
8
8
  let(:foo) { instance_double(SimpleCov::SourceFile) }
9
9
  let(:foo_line_list) { instance_double(Array) }
10
10
  let(:bar) { instance_double(SimpleCov::SourceFile) }
11
11
  let(:bar_line_list) { instance_double(Array) }
12
12
 
13
- describe "#format" do
13
+ describe '#format' do
14
14
  subject(:format) { formatter.format(result) }
15
15
 
16
+ let(:formatted_hash) do
17
+ {
18
+ 'timestamp' => created_at.to_i,
19
+ 'command_name' => 'RSpec',
20
+ 'files' => [
21
+ { 'filename' => '/lib/foo.rb',
22
+ 'covered_percent' => 50.0,
23
+ 'coverage' => [1, nil, 0, 0, nil, 1, nil],
24
+ 'covered_strength' => 0.50,
25
+ 'covered_lines' => 2,
26
+ 'lines_of_code' => 4 },
27
+ { 'filename' => '/lib/bar.rb',
28
+ 'covered_percent' => 71.42,
29
+ 'coverage' => [nil, 1, nil, 1, 1, 1, 0, 0, nil, 1, nil],
30
+ 'covered_strength' => 0.71,
31
+ 'covered_lines' => 5,
32
+ 'lines_of_code' => 7 }
33
+ ],
34
+ 'metrics' => {
35
+ 'covered_percent' => 73.33,
36
+ 'covered_strength' => 0.87,
37
+ 'covered_lines' => 11,
38
+ 'total_lines' => 15
39
+ }
40
+ }.to_json
41
+ end
42
+
16
43
  before do
17
44
  allow(result).to receive(:created_at).and_return(created_at)
18
45
  allow(result).to receive(:command_name).and_return(command_name)
@@ -20,10 +47,10 @@ RSpec.describe SimpleCov::Formatter::OjFormatter do
20
47
  allow(result).to receive(:covered_percent).and_return(73.33)
21
48
  allow(result).to receive(:covered_strength).twice.and_return(0.87)
22
49
  allow(result).to receive(:files).and_return([foo, bar])
23
- allow(result).to receive(:filenames).twice.and_return(["/lib/foo.rb", "/lib/bar.rb"])
50
+ allow(result).to receive(:filenames).twice.and_return(['/lib/foo.rb', '/lib/bar.rb'])
24
51
  allow(result).to receive(:total_lines).and_return(15)
25
52
 
26
- allow(foo).to receive(:filename).twice.and_return("/lib/foo.rb")
53
+ allow(foo).to receive(:filename).twice.and_return('/lib/foo.rb')
27
54
  allow(foo).to receive(:covered_percent).and_return(50.0)
28
55
  if SimpleCov::SourceFile.instance_methods.include?(:coverage_data)
29
56
  allow(foo).to receive(:coverage_data).and_return([1, nil, 0, 0, nil, 1, nil])
@@ -36,7 +63,7 @@ RSpec.describe SimpleCov::Formatter::OjFormatter do
36
63
 
37
64
  allow(foo_line_list).to receive(:count).and_return(2)
38
65
 
39
- allow(bar).to receive(:filename).twice.and_return("/lib/bar.rb")
66
+ allow(bar).to receive(:filename).twice.and_return('/lib/bar.rb')
40
67
  allow(bar).to receive(:covered_percent).and_return(71.42)
41
68
  if SimpleCov::SourceFile.instance_methods.include?(:coverage_data)
42
69
  allow(bar).to receive(:coverage_data).and_return([nil, 1, nil, 1, 1, 1, 0, 0, nil, 1, nil])
@@ -50,31 +77,6 @@ RSpec.describe SimpleCov::Formatter::OjFormatter do
50
77
  allow(bar_line_list).to receive(:count).and_return(5)
51
78
  end
52
79
 
53
- it "formats json nicely" do
54
- expect(format).to eq({
55
- "timestamp" => created_at.to_i,
56
- "command_name" => "RSpec",
57
- "files" => [
58
- { "filename" => "/lib/foo.rb",
59
- "covered_percent" => 50.0,
60
- "coverage" => [1, nil, 0, 0, nil, 1, nil],
61
- "covered_strength" => 0.50,
62
- "covered_lines" => 2,
63
- "lines_of_code" => 4 },
64
- { "filename" => "/lib/bar.rb",
65
- "covered_percent" => 71.42,
66
- "coverage" => [nil, 1, nil, 1, 1, 1, 0, 0, nil, 1, nil],
67
- "covered_strength" => 0.71,
68
- "covered_lines" => 5,
69
- "lines_of_code" => 7 },
70
- ],
71
- "metrics" => {
72
- "covered_percent" => 73.33,
73
- "covered_strength" => 0.87,
74
- "covered_lines" => 11,
75
- "total_lines" => 15,
76
- },
77
- }.to_json)
78
- end
80
+ it { is_expected.to eq(formatted_hash) }
79
81
  end
80
82
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "simplecov-oj"
4
- require "pry"
3
+ require 'simplecov-oj'
4
+ require 'pry'
5
5
 
6
6
  RSpec.configure do |config|
7
7
  config.define_derived_metadata do |meta|
@@ -18,10 +18,10 @@ RSpec.configure do |config|
18
18
 
19
19
  config.shared_context_metadata_behavior = :apply_to_host_groups
20
20
  config.filter_run_when_matching :focus
21
- config.example_status_persistence_file_path = "spec/.rspec-status"
21
+ config.example_status_persistence_file_path = 'spec/.rspec-status'
22
22
  config.disable_monkey_patching!
23
23
  config.warnings = true
24
- config.default_formatter = "doc" if config.files_to_run.one?
24
+ config.default_formatter = 'doc' if config.files_to_run.one?
25
25
  config.profile_examples = 10
26
26
  config.order = :random
27
27
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov-oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-29 00:00:00.000000000 Z
11
+ date: 2020-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj