File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 77* Expand ` Capybara/VisibilityMatcher ` to support more than just ` have_selector ` . ([ @twalpole ] [ ] )
88* Add new ` SpecSuffixOnly ` option to ` RSpec/FilePath ` cop. ([ @zdennis ] [ ] )
99* Allow ` RSpec/RepeatedExampleGroupBody ` to differ only by described_class. ([ @robotdana ] [ ] )
10+ * Fix ` RSpec/FilePath ` detection across sibling directories. ([ @rolfschmidt ] [ ] )
1011
1112## 1.39.0 (2020-05-01)
1213
@@ -512,3 +513,4 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
512513[ @twalpole ] : https://github.com/twalpole
513514[ @zdennis ] : https://github.com/zdennis
514515[ @robotdana ] : https://github.com/robotdana
516+ [ @rolfschmidt ] : https://github.com/rolfschmidt
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ def ignore_methods?
126126 def filename_ends_with? ( glob )
127127 filename =
128128 RuboCop ::PathUtil . relative_path ( processed_source . buffer . name )
129+ . gsub ( '../' , '' )
129130 File . fnmatch? ( "*#{ glob } " , filename )
130131 end
131132
Original file line number Diff line number Diff line change 179179 RUBY
180180 end
181181
182+ it 'uses relative path for sibling directory project' do
183+ allow ( RuboCop ::PathUtil )
184+ . to receive ( :relative_path )
185+ . and_return ( '../ext-project/spec/models/bar_spec.rb' )
186+ expect_no_offenses ( <<-RUBY , '/home/ext-project/spec/models/bar_spec.rb' )
187+ describe Bar do; end
188+ RUBY
189+ end
190+
191+ it 'uses relative path for different path project' do
192+ allow ( RuboCop ::PathUtil )
193+ . to receive ( :relative_path )
194+ . and_return ( '../../opt/ext-project/spec/models/bar_spec.rb' )
195+ expect_no_offenses ( <<-RUBY , '/opt/ext-project/spec/models/bar_spec.rb' )
196+ describe Bar do; end
197+ RUBY
198+ end
199+
182200 context 'when configured with CustomTransform' do
183201 let ( :cop_config ) { { 'CustomTransform' => { 'FooFoo' => 'foofoo' } } }
184202
You can’t perform that action at this time.
0 commit comments