Skip to content

Commit

Permalink
Make color_enabled consistent (#167)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tradiff committed Feb 10, 2023
1 parent 991b1b6 commit da2bcac
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion lib/super_diff/rspec/monkey_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions support/test_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?)
)
Expand Down

0 comments on commit da2bcac

Please sign in to comment.