File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
3
## Master (Unreleased)
4
+ * Fix incorrect path suggested by ` RSpec/FilePath ` cop when second argument contains spaces. ([ @tejasbubane ] [ ] )
4
5
5
6
## 2.11.1 (2022-05-18)
6
7
Original file line number Diff line number Diff line change @@ -117,8 +117,9 @@ def pattern_for_spec_suffix_only?
117
117
118
118
def name_pattern ( method_name )
119
119
return unless method_name &.str_type?
120
+ return if ignore_methods?
120
121
121
- ".*#{ method_name . str_content . gsub ( /\W / , '' ) } " unless ignore_methods?
122
+ ".*#{ method_name . str_content . gsub ( /\s / , '_' ) . gsub ( / \ W /, '' ) } "
122
123
end
123
124
124
125
def expected_path ( constant )
Original file line number Diff line number Diff line change 57
57
RUBY
58
58
end
59
59
60
+ it 'registers an offense when second argument contains spaces' do
61
+ expect_offense ( <<-RUBY , 'wrong_class_spec.rb' )
62
+ describe MyClass, "via `local_failures`" do; end
63
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Spec path should end with `my_class*via_local_failures*_spec.rb`.
64
+ RUBY
65
+ end
66
+
60
67
it 'registers an offense for a file missing _spec' do
61
68
expect_offense ( <<-RUBY , 'spec/models/user.rb' )
62
69
describe User do; end
You can’t perform that action at this time.
0 commit comments