File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
- Fix a false negative for ` RSpec/Pending ` when using skipped in metadata is multiline string. ([ @ydah ] )
6
6
- Fix a false positive for ` RSpec/NoExpectationExample ` when using skipped in metadata is multiline string. ([ @ydah ] )
7
+ - Fix a false positive for ` RSpec/ContextMethod ` when multi-line context with ` # ` at the beginning. ([ @ydah ] )
7
8
8
9
## 2.17.0 (2023-01-13)
9
10
Original file line number Diff line number Diff line change @@ -31,7 +31,11 @@ class ContextMethod < Base
31
31
32
32
# @!method context_method(node)
33
33
def_node_matcher :context_method , <<-PATTERN
34
- (block (send #rspec? :context $(str #method_name?) ...) ...)
34
+ (block
35
+ (send #rspec? :context
36
+ ${(str #method_name?) (dstr (str #method_name?) ...)}
37
+ ...)
38
+ ...)
35
39
PATTERN
36
40
37
41
def on_block ( node ) # rubocop:disable InternalAffairs/NumblockHandler
Original file line number Diff line number Diff line change 43
43
end
44
44
RUBY
45
45
end
46
+
47
+ it 'flags multi-line context with `#` at the beginning' do
48
+ expect_offense ( <<-'RUBY' )
49
+ context '#foo_bar' \
50
+ ^^^^^^^^^^^^ Use `describe` for testing methods.
51
+ '.baz'do
52
+ end
53
+ RUBY
54
+
55
+ expect_correction ( <<-'RUBY' )
56
+ describe '#foo_bar' \
57
+ '.baz'do
58
+ end
59
+ RUBY
60
+ end
46
61
end
You can’t perform that action at this time.
0 commit comments