From da2bcac94909b3700efadd4c4e5e68afe004ad91 Mon Sep 17 00:00:00 2001 From: Travis Collins Date: Fri, 10 Feb 2023 15:48:38 -0700 Subject: [PATCH] Make color_enabled consistent (#167) Disabling color only applies to the diff, not the header and the key. Disabling color is needed for my team, because we use CircleCI which can show color sometimes, and remove it at other times (I believe based on the length of the log). And in the later case, we're seeing ansi color codes. I have confirmed the change proposed in #82 allows us to disable color in all of the output. --- lib/super_diff/rspec/monkey_patches.rb | 2 +- support/test_plan.rb | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/super_diff/rspec/monkey_patches.rb b/lib/super_diff/rspec/monkey_patches.rb index c950a81c..6a8a7c72 100644 --- a/lib/super_diff/rspec/monkey_patches.rb +++ b/lib/super_diff/rspec/monkey_patches.rb @@ -72,7 +72,7 @@ def console_code_for(code_or_symbol) # Patch so it does not apply a color if code_or_symbol is nil def wrap(text, code_or_symbol) - if RSpec.configuration.color_enabled? && code = console_code_for(code_or_symbol) + if SuperDiff.configuration.color_enabled? && code = console_code_for(code_or_symbol) "\e[#{code}m#{text}\e[0m" else text diff --git a/support/test_plan.rb b/support/test_plan.rb index f0134314..302d7f21 100644 --- a/support/test_plan.rb +++ b/support/test_plan.rb @@ -156,10 +156,6 @@ def run_test_with_libraries(*libraries) option_parser.parse! end - RSpec.configure do |config| - config.color_mode = color_enabled? ? :on : :off - end - SuperDiff.configuration.merge!( configuration.merge(color_enabled: color_enabled?) )