Skip to content

Commit 1560c6e

Browse files
committed
Also Provides instance method for apply_custom_colors & used it in the specs
Signed-off-by: Stephan Kämper <the.tester@seasidetesting.com>
1 parent 3488930 commit 1560c6e

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

lib/cucumber/formatter/ansicolor.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ def self.apply_custom_colors(colors)
9494
end
9595
apply_custom_colors(ENV['CUCUMBER_COLORS']) if ENV['CUCUMBER_COLORS']
9696

97+
# Provide an instance method of the same name, in case users are using it.
98+
99+
# Apply the custom color scheme
100+
#
101+
# example:
102+
#
103+
# apply_custom_colors('passed=white')
104+
def apply_custom_colors(colors)
105+
ANSIColor.apply_custom_colors(colors)
106+
end
107+
97108
# Define the color-named methods required by Term::ANSIColor.
98109
#
99110
# Examples:

spec/cucumber/formatter/ansicolor_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module Formatter
3636

3737
context 'with custom color scheme' do
3838
before do
39-
ANSIColor.apply_custom_colors('passed=red,bold')
39+
apply_custom_colors('passed=red,bold')
4040
end
4141

4242
after do
@@ -48,7 +48,7 @@ module Formatter
4848
end
4949

5050
def reset_colours_to_default
51-
ANSIColor.apply_custom_colors('passed=green')
51+
apply_custom_colors('passed=green')
5252
end
5353
end
5454
end

0 commit comments

Comments
 (0)