Skip to content

Commit

Permalink
Merge 812ad8f into bff377d
Browse files Browse the repository at this point in the history
  • Loading branch information
danmayer committed May 3, 2019
2 parents bff377d + 812ad8f commit 661b61a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -335,6 +335,7 @@ If you submit a change please make sure the tests and benchmarks are passing.
- view test coverage: `open coverage/index.html`
- run the benchmarks before and after your change to see impact
- `rake benchmarks`
- run a single test by line number like rspec: `bundle exec m test/coverband/reporters/html_test.rb:29`

### Known Issues

Expand Down
1 change: 1 addition & 0 deletions lib/coverband/reporters/html_report.rb
Expand Up @@ -57,6 +57,7 @@ def self.fix_reports(reports)
filtered_report_files[report_name][file] = data
end
end
filtered_report_files
end
end
end
Expand Down
16 changes: 13 additions & 3 deletions test/coverband/reporters/html_test.rb
Expand Up @@ -9,10 +9,9 @@ def setup
@store = Coverband::Adapters::RedisStore.new(@redis)
@store.clear!
Coverband.configure do |config|
config.reporter = 'scov'
config.store = @store
config.s3_bucket = nil
config.ignore = ['notsomething.rb']
config.root = fixtures_root
config.ignore = ['notsomething.rb', 'lib/*']
end
mock_file_hash
end
Expand All @@ -26,6 +25,17 @@ def setup
assert_match 'Generated by', html
end

test 'files with no Coverage but in project are shown in reports' do
@store.send(:save_report, basic_source_fixture_coverage)

html = Coverband::Reporters::HTMLReport.new(@store,
html: true,
open_report: false).report
assert_match 'sample.rb', html
# in project, but not in coverage data
assert_match 'app/models/user.rb', html
end

test 'generate static HTML report file' do
@store.send(:save_report, basic_coverage)

Expand Down
8 changes: 8 additions & 0 deletions test/test_helper.rb
Expand Up @@ -88,6 +88,10 @@ def basic_coverage_full_path
{ basic_coverage_file_full_path => example_line }
end

def basic_source_fixture_coverage
{ source_fixture('sample.rb') => example_line }
end

def basic_coverage_file_full_path
"#{test_root}/dog.rb"
end
Expand All @@ -96,6 +100,10 @@ def source_fixture(filename)
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', filename))
end

def fixtures_root
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
end

def test_root
File.expand_path(File.join(File.dirname(__FILE__)))
end
Expand Down

0 comments on commit 661b61a

Please sign in to comment.