coverband 4.0.1.beta → 4.0.1

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
  SHA1:
3
- metadata.gz: 287311c05b4d4bc1e85d1a8cc19d9a5630551fa8
4
- data.tar.gz: f73c312bb5c4eceff8dd48e92d9191e5c57d80e9
3
+ metadata.gz: b7f0d091dfa76cb111bc6e76be9f03a644c9f7c9
4
+ data.tar.gz: d326e418b2612a0fd5ea9d17786918d9da90a5df
5
5
  SHA512:
6
- metadata.gz: 2fd7fa9ceae554e6dba27834be7527b2df2a8160b68079124de97f3e986a0141dea24e467832c85881dd3f6753506b1fdc060d72226a0f009daf7c3dde66500c
7
- data.tar.gz: 55566a5fef66122bcd908b6fb1d488727f55dabff12e0dfa0d73530727555c9bd6b6d7e104b1e14d9ebf5950984c7a82aaaa011e7aba68d32c923646d3a2f071
6
+ metadata.gz: 55288f996b6d5bc015e368c6952daf867b5a21fa0f5a09fdd7bfad3f19f0b11c6e12ca912e6121e315b23a15ca1ac03629552811874f8176ee882b91aafed967
7
+ data.tar.gz: 37fc422e6b917dacbede5a143bc2504f1da47dbf528e3164e91661545aa2bccd1c70332a2e8783414986c5bbd89925804c28961f20f321bf0073d034c9f56eaa
data/changes.md CHANGED
@@ -64,15 +64,25 @@ Feature Ideas:
64
64
 
65
65
  # Alpha
66
66
 
67
- ### Coverband 4.0.1.alpha
67
+ ### Coverband 4.0.2.alpha
68
68
 
69
- - drops simplecov runtime dependency
70
- - still used to measure our own code coverage ;)
71
- - thanks SimpleCov for all the years of solid HTML reporting, and support!
72
- - reduced the S3 dependencies to minimal set (not loading all of aws-sdk), ensured they are optional
69
+ - ?
73
70
 
74
71
  # Released
75
72
 
73
+ ### Coverband 4.0.1
74
+
75
+ - drops Simplecov runtime dependency
76
+ - still used to measure our own code coverage ;)
77
+ - thanks SimpleCov for all the years of solid HTML reporting, and support!
78
+ - reduced the S3 dependencies to minimal set (not loading all of aws-sdk, only aws-sdk-s3), ensured they are optional
79
+ - Improved Coverband web admin
80
+ - Coverage reports include timestamps of Coverage collection
81
+ - Added Coveralls to the dev process thanks @dondonz
82
+ - now tested under Ruby 2.6.0 thanks @Kbaum
83
+ - improved full stack testing for Rails 5 & 4
84
+ - warning before clear coverage on coverband web
85
+
76
86
  ### Coverband 4.0.0
77
87
 
78
88
  - Add support for Railties integration
@@ -22,15 +22,16 @@ module Coverband
22
22
  end
23
23
 
24
24
  def coverage
25
- simple_report(get_report)
25
+ get_report
26
26
  end
27
27
 
28
28
  def covered_files
29
29
  coverage.keys || []
30
30
  end
31
31
 
32
+ # TODO: deprecate / remove?
32
33
  def covered_lines_for_file(file)
33
- coverage[file] || []
34
+ Array(coverage.dig(file, 'data'))
34
35
  end
35
36
 
36
37
  protected
@@ -10,7 +10,11 @@ module Coverband
10
10
  scov_style_report = super(store, options)
11
11
 
12
12
  scov_style_report.each_pair do |file, usage|
13
- Coverband.configuration.logger.info "#{file}: #{usage}"
13
+ if usage.is_a?(Hash)
14
+ Coverband.configuration.logger.info "#{file}: #{usage['data']}"
15
+ else
16
+ Coverband.configuration.logger.info "#{file}: #{usage}"
17
+ end
14
18
  end
15
19
  scov_style_report
16
20
  end
@@ -81,9 +81,24 @@ module Coverband
81
81
  # The array of coverage data received from the Coverage.result
82
82
  attr_reader :coverage
83
83
 
84
- def initialize(filename, coverage)
84
+ # the date this version of the file first started to record coverage
85
+ attr_reader :first_updated_at
86
+ # the date this version of the file last saw any coverage activity
87
+ attr_reader :last_updated_at
88
+ NOT_AVAILABLE = 'not available'
89
+
90
+ def initialize(filename, file_data)
85
91
  @filename = filename
86
- @coverage = coverage
92
+ if file_data.is_a?(Hash)
93
+ @coverage = file_data['data']
94
+ @first_updated_at = @last_updated_at = NOT_AVAILABLE
95
+ @first_updated_at = Time.at(file_data['first_updated_at']) if file_data['first_updated_at']
96
+ @last_updated_at = Time.at(file_data['last_updated_at']) if file_data['last_updated_at']
97
+ else
98
+ @coverage = file_data
99
+ @first_updated_at = NOT_AVAILABLE
100
+ @last_updated_at = NOT_AVAILABLE
101
+ end
87
102
  end
88
103
 
89
104
  # The path to this source file relative to the projects directory
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coverband
4
- VERSION = '4.0.1.beta'
4
+ VERSION = '4.0.1'
5
5
  end
@@ -16,16 +16,22 @@ class RedisTest < Minitest::Test
16
16
  mock_file_hash
17
17
  expected = basic_coverage
18
18
  @store.save_report(expected)
19
- assert_equal expected, @store.coverage
19
+ assert_equal expected.keys, @store.coverage.keys
20
+ @store.coverage.each_pair do |key, data|
21
+ assert_equal expected[key], data['data']
22
+ end
20
23
  end
21
24
 
22
25
  def test_coverage_increments
23
26
  mock_file_hash
24
27
  expected = basic_coverage.dup
25
28
  @store.save_report(basic_coverage.dup)
26
- assert_equal expected, @store.coverage
29
+ assert_equal expected.keys, @store.coverage.keys
30
+ @store.coverage.each_pair do |key, data|
31
+ assert_equal expected[key], data['data']
32
+ end
27
33
  @store.save_report(basic_coverage.dup)
28
- assert_equal [0, 2, 4], @store.coverage['app_path/dog.rb']
34
+ assert_equal [0, 2, 4], @store.coverage['app_path/dog.rb']['data']
29
35
  end
30
36
 
31
37
  def test_covered_lines_for_file
@@ -18,7 +18,7 @@ class FullStackTest < Minitest::Test
18
18
  Coverband.configuration.store.clear!
19
19
  Coverband.start
20
20
  @rack_file = File.expand_path(TEST_RACK_APP, File.dirname(__FILE__))
21
- require @rack_file
21
+ load @rack_file
22
22
  end
23
23
 
24
24
  test 'call app' do
@@ -26,13 +26,15 @@ class FullStackTest < Minitest::Test
26
26
  middleware = Coverband::Middleware.new(fake_app_with_lines)
27
27
  results = middleware.call(request)
28
28
  assert_equal 'Hello Rack!', results.last
29
+ sleep(0.1)
29
30
  expected = [nil, nil, 1, nil, 1, 1, 1, nil, nil]
30
- assert_equal expected, Coverband.configuration.store.coverage[@rack_file]
31
+ assert_equal expected, Coverband.configuration.store.coverage[@rack_file]['data']
31
32
 
32
33
  # additional calls increase count by 1
33
34
  middleware.call(request)
35
+ sleep(0.1)
34
36
  expected = [nil, nil, 1, nil, 1, 1, 2, nil, nil]
35
- assert_equal expected, Coverband.configuration.store.coverage[@rack_file]
37
+ assert_equal expected, Coverband.configuration.store.coverage[@rack_file]['data']
36
38
 
37
39
  # expected = nil
38
40
  # TODO: read the html to test it matches expectations? or return data as a hash?
@@ -24,7 +24,6 @@ class RailsFullStackTest < Minitest::Test
24
24
  assert_content('I am no dummy')
25
25
  sleep 0.2
26
26
  visit '/coverage'
27
- click_link "view coverage report"
28
27
  within page.find('a', text: /dummy_controller.rb/).find(:xpath, "../..") do
29
28
  assert_selector('td', text: '100.0 %')
30
29
  end
@@ -27,6 +27,6 @@ class HTMLReportTest < Minitest::Test
27
27
 
28
28
  report = Coverband::Reporters::ConsoleReport.report(@store)
29
29
  expected = { 'app_path/dog.rb' => [0, 1, 2] }
30
- assert_equal(expected, report)
30
+ assert_equal(expected.keys, report.keys)
31
31
  end
32
32
  end
@@ -25,7 +25,7 @@ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.2.0')
25
25
  test 'renders index content' do
26
26
  get '/'
27
27
  assert last_response.ok?
28
- assert_match 'Coverband Web Admin Index', last_response.body
28
+ assert_match 'Coverband Admin', last_response.body
29
29
  end
30
30
 
31
31
  test 'renders show content' do
@@ -3,12 +3,16 @@
3
3
  <h3><%= shortened_filename source_file %></h3>
4
4
  <h4><span class="<%= coverage_css_class(source_file.covered_percent) %>"><%= source_file.covered_percent.round(2).to_s %> %</span> covered</h4>
5
5
  <div>
6
- <b><%= source_file.lines_of_code %></b> relevant lines.
6
+ <b><%= source_file.lines_of_code %></b> relevant lines.
7
7
  <span class="green"><b><%= source_file.covered_lines.count %></b> lines covered</span> and
8
8
  <span class="red"><b><%= source_file.missed_lines.count %></b> lines missed.</span>
9
9
  </div>
10
+ <div>
11
+ Coverage first seen: <%= source_file.first_updated_at %>, last activity recorded:
12
+ <%= source_file.last_updated_at %>
13
+ </div>
10
14
  </div>
11
-
15
+
12
16
  <pre>
13
17
  <ol>
14
18
  <% source_file.lines.each do |line| %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1.beta
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-12-29 00:00:00.000000000 Z
12
+ date: 2018-12-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-s3
@@ -368,9 +368,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
368
368
  version: '0'
369
369
  required_rubygems_version: !ruby/object:Gem::Requirement
370
370
  requirements:
371
- - - ">"
371
+ - - ">="
372
372
  - !ruby/object:Gem::Version
373
- version: 1.3.1
373
+ version: '0'
374
374
  requirements: []
375
375
  rubyforge_project:
376
376
  rubygems_version: 2.5.1