Skip to content

Commit

Permalink
fix read json
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Savignano committed Nov 3, 2019
1 parent deeb00a commit 6dc7a86
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 172 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A GitHub Action that check minimum coverage percentage!
#### [Simplecov](https://github.com/colszowka/simplecov)

```yml
- uses: devmasx/[email protected].0
- uses: devmasx/[email protected].1
with:
result_path: coverage/.last_run.json
token: ${{secrets.GITHUB_TOKEN}}
Expand Down
2 changes: 1 addition & 1 deletion lib/coverage_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.jest(report_path, data)

private

def read_json(path)
def self.read_json(path)
JSON.parse(File.read(path))
end
end
10 changes: 10 additions & 0 deletions spec/coverage_report_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

require './spec/spec_helper'

describe CoverageReport do
it '.simplecov' do
result = CoverageReport.simplecov('./spec/fixtures/simplecov.json', min: 80)
expect(result['lines']['covered_percent']).to eq(80.5)
end
end
170 changes: 0 additions & 170 deletions spec/fixtures/report.json

This file was deleted.

5 changes: 5 additions & 0 deletions spec/fixtures/simplecov.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"result": {
"covered_percent": 80.5
}
}
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
require './lib/report_adapter'
require './lib/github_check_run_service'
require './lib/github_client'
require './lib/coverage_report'

0 comments on commit 6dc7a86

Please sign in to comment.