|
7 | 7 | expect_offense(<<-RUBY) |
8 | 8 | describe Foo do |
9 | 9 | before { bar } |
10 | | - ^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
| 10 | + ^^^^^^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on line 3). |
11 | 11 | before { baz } |
12 | | - ^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
| 12 | + ^^^^^^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on line 2). |
13 | 13 | end |
14 | 14 | RUBY |
15 | 15 | end |
16 | 16 |
|
17 | 17 | it 'flags multiple hooks of the same scope with different symbols' do |
18 | 18 | expect_offense(<<-RUBY) |
19 | 19 | describe Foo do |
20 | | - before { bar } |
21 | | - ^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
22 | | - before(:each) { baz } |
23 | | - ^^^^^^^^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
24 | | - before(:example) { baz } |
25 | | - ^^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
| 20 | + after { bar } |
| 21 | + ^^^^^^^^^^^^^ Do not define multiple `after` hooks in the same example group (also defined on lines 3, 4). |
| 22 | + after(:each) { baz } |
| 23 | + ^^^^^^^^^^^^^^^^^^^^ Do not define multiple `after` hooks in the same example group (also defined on lines 2, 4). |
| 24 | + after(:example) { baz } |
| 25 | + ^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple `after` hooks in the same example group (also defined on lines 2, 3). |
26 | 26 | end |
27 | 27 | RUBY |
28 | 28 | end |
|
31 | 31 | expect_offense(<<-RUBY) |
32 | 32 | describe Foo do |
33 | 33 | before(:all) { bar } |
34 | | - ^^^^^^^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
| 34 | + ^^^^^^^^^^^^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on line 3). |
35 | 35 | before(:all) { baz } |
36 | | - ^^^^^^^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
| 36 | + ^^^^^^^^^^^^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on line 2). |
37 | 37 | end |
38 | 38 | RUBY |
39 | 39 | end |
|
109 | 109 | expect_offense(<<-RUBY) |
110 | 110 | describe Foo do |
111 | 111 | before(:each, :special_case) { foo } |
112 | | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
| 112 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on lines 3, 4, 5). |
113 | 113 | before(:example, :special_case) { bar } |
114 | | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
| 114 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on lines 2, 4, 5). |
115 | 115 | before(:example, special_case: true) { bar } |
116 | | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
| 116 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on lines 2, 3, 5). |
117 | 117 | before(special_case: true) { bar } |
118 | | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple hooks in the same example group. |
| 118 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on lines 2, 3, 4). |
119 | 119 | before(:example, special_case: false) { bar } |
120 | 120 | end |
121 | 121 | RUBY |
|
0 commit comments