coverband 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path('../test_helper', File.dirname(__FILE__))
4
-
5
- class ReporterTest < Test::Unit::TestCase
6
-
7
- test 'record baseline' do
8
- Coverband.configure do |config|
9
- config.store = Coverband::Adapters::FileStore.new(TEST_COVERAGE_FILE)
10
- end
11
- Coverage.expects(:start).returns(true).at_least_once
12
- Coverage.expects(:result).returns('fake' => [0, 1]).at_least_once
13
- File.expects(:open).once
14
-
15
- File.expects(:exist?).at_least_once.returns(true)
16
- expected = { 'filename.rb' => [0, nil, 1] }
17
- fake_file_data = expected.to_json
18
- File.expects(:read).at_least_once.returns(fake_file_data)
19
-
20
- Coverband::Baseline.record do
21
- # nothing
22
- end
23
- end
24
-
25
- test 'parse baseline' do
26
- Coverband.configure do |config|
27
- config.redis = nil
28
- config.store = nil
29
- config.root = '/full/remote_app/path'
30
- config.store = Coverband::Adapters::FileStore.new(TEST_COVERAGE_FILE)
31
- end
32
- File.expects(:exist?).at_least_once.returns(true)
33
- expected = { 'filename.rb' => [0, nil, 1] }
34
- fake_file_data = expected.to_json
35
- File.expects(:read).at_least_once.returns(fake_file_data)
36
- results = Coverband::Baseline.parse_baseline
37
- assert_equal(results, 'filename.rb' => [0, nil, 1])
38
- end
39
-
40
- test 'exclude_files' do
41
- Coverband.configure do |config|
42
- config.redis = nil
43
- config.store = nil
44
- config.root = '/full/remote_app/path'
45
- config.store = Coverband::Adapters::FileStore.new(TEST_COVERAGE_FILE)
46
- config.ignore = ['ignored_file.rb']
47
- end
48
- root = Coverband.configuration.root
49
- files = [root + '/ignored_file.rb', root + '/fakefile.rb']
50
- expected_files = [root + '/fakefile.rb']
51
- assert_equal(expected_files, Coverband::Baseline.exclude_files(files))
52
- end
53
-
54
- test 'convert_coverage_format' do
55
- results = { 'fake_file.rb' => [1, nil, 0, 2] }
56
- expected = { 'fake_file.rb' => { 1 => 1, 3 => 0, 4 => 2 } }
57
- assert_equal(expected, Coverband::Baseline.convert_coverage_format(results))
58
- end
59
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path('../test_helper', File.dirname(__FILE__))
4
- require 'aws-sdk'
5
- require File.expand_path('../../lib/coverband/s3_web', File.dirname(__FILE__))
6
- require 'rack/test'
7
-
8
- ENV['RACK_ENV'] = 'test'
9
-
10
- module Coverband
11
- class S3WebTest < Test::Unit::TestCase
12
- include Rack::Test::Methods
13
-
14
- def app
15
- Coverband::S3Web
16
- end
17
-
18
- test 'renders content from the coverband/index.html object' do
19
- Coverband.configuration.s3_bucket = 'coverage-bucket'
20
- s3 = mock('s3')
21
- Aws::S3::Client.expects(:new).returns(s3)
22
- s3.expects(:get_object).with(bucket: 'coverage-bucket', key: 'coverband/index.html').returns mock('response', body: mock('body', read: 'content'))
23
- get '/'
24
- assert last_response.ok?
25
- assert_equal 'content', last_response.body
26
- end
27
- end
28
- end