This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ Enhancements:
53
53
to force the run to abort after the specified number of failures.
54
54
(Jack Scotti, #2065 )
55
55
* Syntax highlight the failure snippets in text formatters when ` color `
56
- is enabled and the ` coderay ` gem is installed. (Myron Marston, #2109 )
56
+ is enabled and the ` coderay ` gem is installed on a POSIX system.
57
+ (Myron Marston, #2109 )
57
58
58
59
Bug Fixes:
59
60
Original file line number Diff line number Diff line change @@ -15,9 +15,17 @@ def highlight(lines)
15
15
16
16
private
17
17
18
- def implementation
19
- return color_enabled_implementation if @configuration . color_enabled?
20
- ColorDisabledImplementation
18
+ if RSpec ::Support ::OS . windows?
19
+ # :nocov:
20
+ def implementation
21
+ WindowsImplementation
22
+ end
23
+ # :nocov:
24
+ else
25
+ def implementation
26
+ return color_enabled_implementation if @configuration . color_enabled?
27
+ ColorDisabledImplementation
28
+ end
21
29
end
22
30
23
31
def color_enabled_implementation
@@ -58,6 +66,11 @@ def self.highlight_syntax(lines)
58
66
lines
59
67
end
60
68
end
69
+
70
+ # @private
71
+ # Not sure why, but our code above (and/or coderay itself) does not work
72
+ # on Windows, so we disable the feature on Windows.
73
+ WindowsImplementation = ColorDisabledImplementation
61
74
end
62
75
end
63
76
end
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ def be_highlighted
9
9
include ( "\e [32m" )
10
10
end
11
11
12
- context "when CodeRay is available" do
12
+ context "when CodeRay is available" , :unless => RSpec :: Support :: OS . windows? do
13
13
before { expect { require 'coderay' } . not_to raise_error }
14
14
15
15
it 'highlights the syntax of the provided lines' do
@@ -54,7 +54,7 @@ def be_highlighted
54
54
expect ( unhighlighted . first ) . not_to be_highlighted
55
55
end
56
56
57
- it 'adds a comment explaining the user can get syntax highlighting by installing coderay' do
57
+ it 'adds a comment explaining the user can get syntax highlighting by installing coderay' , :unless => RSpec :: Support :: OS . windows? do
58
58
lines = [ "a = 1" , "b = 2" ]
59
59
expect ( highlighter . highlight ( lines ) ) . to eq ( [
60
60
"a = 1" ,
@@ -63,7 +63,7 @@ def be_highlighted
63
63
] )
64
64
end
65
65
66
- it 'indents the "install coderay" comment to match the snippet' do
66
+ it 'indents the "install coderay" comment to match the snippet' , :unless => RSpec :: Support :: OS . windows? do
67
67
lines = [ " a = 1" , " b = 2" ]
68
68
expect ( highlighter . highlight ( lines ) ) . to eq ( [
69
69
" a = 1" ,
You can’t perform that action at this time.
0 commit comments