Class: CodeClimate::TestReporter::PostResults
- Inherits:
-
Object
- Object
- CodeClimate::TestReporter::PostResults
- Defined in:
- lib/code_climate/test_reporter/post_results.rb
Instance Method Summary collapse
-
#initialize(results) ⇒ PostResults
constructor
A new instance of PostResults.
- #post ⇒ Object
Constructor Details
#initialize(results) ⇒ PostResults
Returns a new instance of PostResults.
4 5 6 |
# File 'lib/code_climate/test_reporter/post_results.rb', line 4 def initialize(results) @results = results end |
Instance Method Details
#post ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/code_climate/test_reporter/post_results.rb', line 8 def post if write_to_file? file_path = File.join(Dir.tmpdir, "codeclimate-test-coverage-#{SecureRandom.uuid}.json") print "Coverage results saved to #{file_path}... " File.open(file_path, "w") { |file| file.write(@results.to_json) } else client = Client.new print "Sending report to #{client.host} for branch #{Git.branch_from_git_or_ci}... " client.post_results(@results) end puts "done." end |