From 70da60b4add96b6a40f6bf8df0b61f2c892a32e1 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Thu, 11 May 2017 16:42:29 -0300 Subject: [PATCH] Ticket #5651: Fix code coverage On Check Api test, the classes are reloaded and this was messing up with the code coverage. Each time the file was reloaded, it reset the coverage. This patch merges the results. Found on https://github.com/colszowka/simplecov/issues/389 --- test/models/check_api_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/models/check_api_test.rb b/test/models/check_api_test.rb index 19053ed..86f8f28 100644 --- a/test/models/check_api_test.rb +++ b/test/models/check_api_test.rb @@ -22,6 +22,11 @@ def setup @project_media_without_translation_result = project_media_without_translation_result end + test "should return project slug as string representation bla" do + token = BRIDGE_CONFIG['check_api_token'] + assert_equal token, Check::HTTPAdapter.headers('context')['X-Check-Token'] + end + test "should return project slug as string representation" do assert_equal 'check-api', @check.to_s end @@ -61,6 +66,10 @@ def setup private def reload_classes + SimpleCov.result + SimpleCov.start do + command_name "#{command_name}1" + end Object.send(:remove_const, :Check) if Module.const_defined?(:Check) load File.join(Rails.root, 'lib', 'check_api_client.rb') Sources.send(:remove_const, :CheckApi) if Module.const_defined?(:CheckApi)