|
13 | 13 | end
|
14 | 14 |
|
15 | 15 | it 'finds context without `when` at the beginning' do
|
16 |
| - expect_offense(<<-RUBY) |
| 16 | + expect_offense(<<-'RUBY') |
17 | 17 | context 'the display name not present' do
|
18 |
| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /^when\\b/, /^with\\b/, or /^without\\b/. |
| 18 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /^when\b/, /^with\b/, or /^without\b/. |
19 | 19 | end
|
20 | 20 | RUBY
|
21 | 21 | end
|
22 | 22 |
|
23 | 23 | it 'finds shared_context without `when` at the beginning' do
|
24 |
| - expect_offense(<<-RUBY) |
| 24 | + expect_offense(<<-'RUBY') |
25 | 25 | shared_context 'the display name not present' do
|
26 |
| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /^when\\b/, /^with\\b/, or /^without\\b/. |
| 26 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /^when\b/, /^with\b/, or /^without\b/. |
27 | 27 | end
|
28 | 28 | RUBY
|
29 | 29 | end
|
|
43 | 43 | end
|
44 | 44 |
|
45 | 45 | it 'finds context without separate `when` at the beginning' do
|
46 |
| - expect_offense(<<-RUBY) |
| 46 | + expect_offense(<<-'RUBY') |
47 | 47 | context 'whenever you do' do
|
48 |
| - ^^^^^^^^^^^^^^^^^ Context description should match /^when\\b/, /^with\\b/, or /^without\\b/. |
| 48 | + ^^^^^^^^^^^^^^^^^ Context description should match /^when\b/, /^with\b/, or /^without\b/. |
49 | 49 | end
|
50 | 50 | RUBY
|
51 | 51 | end
|
52 | 52 |
|
53 | 53 | context 'with metadata hash' do
|
54 | 54 | it 'finds context without separate `when` at the beginning' do
|
55 |
| - expect_offense(<<-RUBY) |
| 55 | + expect_offense(<<-'RUBY') |
56 | 56 | context 'whenever you do', legend: true do
|
57 |
| - ^^^^^^^^^^^^^^^^^ Context description should match /^when\\b/, /^with\\b/, or /^without\\b/. |
| 57 | + ^^^^^^^^^^^^^^^^^ Context description should match /^when\b/, /^with\b/, or /^without\b/. |
58 | 58 | end
|
59 | 59 | RUBY
|
60 | 60 | end
|
61 | 61 | end
|
62 | 62 |
|
63 | 63 | context 'with symbol metadata' do
|
64 | 64 | it 'finds context without separate `when` at the beginning' do
|
65 |
| - expect_offense(<<-RUBY) |
| 65 | + expect_offense(<<-'RUBY') |
66 | 66 | context 'whenever you do', :legend do
|
67 |
| - ^^^^^^^^^^^^^^^^^ Context description should match /^when\\b/, /^with\\b/, or /^without\\b/. |
| 67 | + ^^^^^^^^^^^^^^^^^ Context description should match /^when\b/, /^with\b/, or /^without\b/. |
68 | 68 | end
|
69 | 69 | RUBY
|
70 | 70 | end
|
71 | 71 | end
|
72 | 72 |
|
73 | 73 | context 'with mixed metadata' do
|
74 | 74 | it 'finds context without separate `when` at the beginning' do
|
75 |
| - expect_offense(<<-RUBY) |
| 75 | + expect_offense(<<-'RUBY') |
76 | 76 | context 'whenever you do', :legend, myth: true do
|
77 |
| - ^^^^^^^^^^^^^^^^^ Context description should match /^when\\b/, /^with\\b/, or /^without\\b/. |
| 77 | + ^^^^^^^^^^^^^^^^^ Context description should match /^when\b/, /^with\b/, or /^without\b/. |
78 | 78 | end
|
79 | 79 | RUBY
|
80 | 80 | end
|
|
84 | 84 | let(:cop_config) { { 'Prefixes' => %w[if], 'AllowedPatterns' => [] } }
|
85 | 85 |
|
86 | 86 | it 'finds context without allowed prefixes at the beginning' do
|
87 |
| - expect_offense(<<-RUBY) |
| 87 | + expect_offense(<<-'RUBY') |
88 | 88 | context 'when display name is present' do
|
89 |
| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /^if\\b/. |
| 89 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /^if\b/. |
90 | 90 | end
|
91 | 91 | RUBY
|
92 | 92 | end
|
|
115 | 115 | let(:cop_config) { { 'Prefixes' => ['a$b\d'], 'AllowedPatterns' => [] } }
|
116 | 116 |
|
117 | 117 | it 'matches the full prefix' do
|
118 |
| - expect_offense(<<-RUBY) |
| 118 | + expect_offense(<<-'RUBY') |
119 | 119 | context 'a' do
|
120 |
| - ^^^ Context description should match /^a\\$b\\\\d\\b/. |
| 120 | + ^^^ Context description should match /^a\$b\\d\b/. |
121 | 121 | end
|
122 | 122 | RUBY
|
123 | 123 | end
|
124 | 124 |
|
125 | 125 | it 'matches special characters' do
|
126 |
| - expect_no_offenses(<<-RUBY) |
127 |
| - context 'a$b\\d something' do |
| 126 | + expect_no_offenses(<<-'RUBY') |
| 127 | + context 'a$b\d something' do |
128 | 128 | end
|
129 | 129 | RUBY
|
130 | 130 | end
|
|
166 | 166 |
|
167 | 167 | it 'finds context without `when` at the beginning and not included ' \
|
168 | 168 | '`/patterns/`' do
|
169 |
| - expect_offense(<<-RUBY) |
| 169 | + expect_offense(<<-'RUBY') |
170 | 170 | context 'this is an incorrect context' do
|
171 |
| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /patterns/, or /^when\\b/. |
| 171 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /patterns/, or /^when\b/. |
172 | 172 | end
|
173 | 173 | RUBY
|
174 | 174 | end
|
175 | 175 |
|
176 | 176 | it 'finds shared_context without `when` at the beginning and ' \
|
177 | 177 | 'not included `/patterns/`' do
|
178 |
| - expect_offense(<<-RUBY) |
| 178 | + expect_offense(<<-'RUBY') |
179 | 179 | shared_context 'this is an incorrect context' do
|
180 |
| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /patterns/, or /^when\\b/. |
| 180 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Context description should match /patterns/, or /^when\b/. |
181 | 181 | end
|
182 | 182 | RUBY
|
183 | 183 | end
|
|
0 commit comments