From 09b6c46036e07bf1bd3af1ec8f9af0b720a2d119 Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Thu, 1 Dec 2016 19:22:45 +0000 Subject: [PATCH] Disable VCR when sending coverage and add notes to readme --- README.md | 13 +++++++++++++ lib/codacy/client.rb | 2 ++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 769e297..5d08092 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,19 @@ export DEBUG_STDOUT=true You can now check your coverage results in the Codacy dashboard of your project. +## Troubleshoot + +**Cannot send coverage when using VCR** + +``` +require 'vcr' +VCR.configure do |config| + # other config options + c.allow_http_connections_when_no_cassette = false + c.ignore_hosts 'api.codacy.com' +end +``` + ## What is Codacy? [Codacy](https://www.codacy.com/) is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews. diff --git a/lib/codacy/client.rb b/lib/codacy/client.rb index c30bbc1..8782236 100644 --- a/lib/codacy/client.rb +++ b/lib/codacy/client.rb @@ -23,7 +23,9 @@ def self.post_results(parsed_result) false else logger.info('Posting ' + result.to_s.length.to_s + ' bytes to ' + url) + VCR.turn_off! if Object.const_defined?('VCR') && VCR.respond_to?(:turn_off!) response = send_request(url, result, project_token) + VCR.turn_on! if Object.const_defined?('VCR') && VCR.respond_to?(:turn_on!) logger.info(response) response.to_s.include? 'success'