Skip to content

Commit

Permalink
Also Provides instance method for apply_custom_colors & used it in th…
Browse files Browse the repository at this point in the history
…e specs

Signed-off-by: Stephan Kämper <[email protected]>
  • Loading branch information
s2k committed May 23, 2022
1 parent 3488930 commit 1560c6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions lib/cucumber/formatter/ansicolor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ def self.apply_custom_colors(colors)
end
apply_custom_colors(ENV['CUCUMBER_COLORS']) if ENV['CUCUMBER_COLORS']

# Provide an instance method of the same name, in case users are using it.

# Apply the custom color scheme
#
# example:
#
# apply_custom_colors('passed=white')
def apply_custom_colors(colors)
ANSIColor.apply_custom_colors(colors)
end

# Define the color-named methods required by Term::ANSIColor.
#
# Examples:
Expand Down
4 changes: 2 additions & 2 deletions spec/cucumber/formatter/ansicolor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module Formatter

context 'with custom color scheme' do
before do
ANSIColor.apply_custom_colors('passed=red,bold')
apply_custom_colors('passed=red,bold')
end

after do
Expand All @@ -48,7 +48,7 @@ module Formatter
end

def reset_colours_to_default
ANSIColor.apply_custom_colors('passed=green')
apply_custom_colors('passed=green')
end
end
end
Expand Down

0 comments on commit 1560c6e

Please sign in to comment.