|
54 | 54 | write_config(valid_config) |
55 | 55 |
|
56 | 56 | expect(Undercover::Report) |
57 | | - .to receive(:new).and_wrap_original do |m, changeset, opts| |
| 57 | + .to receive(:new).and_wrap_original do |m, changeset, opts, coverage_adapter| |
58 | 58 | expect(opts.lcov).to eq('coverage/lcov/fixtures.lcov') |
59 | 59 | expect(opts.path).to eq('.') |
60 | 60 | expect(opts.syntax_version).to eq('ruby34') |
61 | 61 | expect(opts.glob_allow_filters).to eq(['*.rb', 'Rakefile']) |
62 | 62 | expect(opts.glob_reject_filters).to eq(['db/*']) |
63 | 63 | expect(opts.max_warnings_limit).to eq(100) |
64 | | - m.call(changeset, opts) |
| 64 | + m.call(changeset, opts, coverage_adapter) |
65 | 65 | end |
66 | 66 |
|
67 | 67 | Pronto.run(:staged, 'test.git', nil) |
|
100 | 100 |
|
101 | 101 | context 'with JSON formatter option' do |
102 | 102 | it 'correctly reports on a patch inside of a changed file from JSON report' do |
103 | | - config = valid_config.merge( |
104 | | - 'simplecov' => 'coverage/fixtures_coverage.json', |
105 | | - 'lcov' => nil |
106 | | - ) |
| 103 | + config = valid_config.merge('simplecov' => 'coverage/fixtures_coverage.json') |
107 | 104 | write_config(config) |
108 | 105 |
|
109 | 106 | expect_any_instance_of(Undercover::LcovParser).to receive(:coverage).never |
|
126 | 123 | delete_config |
127 | 124 | end |
128 | 125 | end |
| 126 | + |
| 127 | + it 'accepts include-files and exclude-files options' do |
| 128 | + config = valid_config.merge( |
| 129 | + 'simplecov' => 'coverage/fixtures_coverage.json', |
| 130 | + 'include-files' => '*.rb', |
| 131 | + 'exclude-files' => 'module.rb' |
| 132 | + ) |
| 133 | + write_config(config) |
| 134 | + |
| 135 | + results = Pronto.run(:unstaged, 'test.git', nil) |
| 136 | + |
| 137 | + matched_files = results.map { _1.path } |
| 138 | + expect(matched_files).to include('patch.rb') |
| 139 | + expect(matched_files).not_to include('module.rb') |
| 140 | + |
| 141 | + delete_config |
| 142 | + end |
129 | 143 | end |
130 | 144 | end |
131 | 145 |
|
|
0 commit comments