File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33RSpec . describe RuboCop ::Cop ::RSpec ::Cop do
4- subject ( :cop ) { fake_cop . new ( config ) }
4+ subject ( :cop ) { RuboCop :: RSpec :: FakeCop . new ( config ) }
55
66 let ( :config ) do
77 rubocop_config =
1919 RuboCop ::Config . new ( rubocop_config , 'fake_cop_config.yml' )
2020 end
2121
22- let ( :fake_cop ) do
23- # rubocop:disable Style/ClassAndModuleChildren
24- # rubocop:disable RSpec/LeakyConstantDeclaration
25- class RuboCop ::RSpec ::FakeCop < described_class
26- def on_send ( node )
27- add_offense ( node , message : 'I flag everything' )
28- end
29- end
30- # rubocop:enable Style/ClassAndModuleChildren
31- # rubocop:enable RSpec/LeakyConstantDeclaration
32- RuboCop ::RSpec ::FakeCop
33- end
34-
3522 let ( :rspec_patterns ) { [ '_spec.rb$' , '(?:^|/)spec/' ] }
3623
24+ before do
25+ stub_const ( 'RuboCop::RSpec::FakeCop' ,
26+ Class . new ( described_class ) do
27+ def on_send ( node )
28+ add_offense ( node , message : 'I flag everything' )
29+ end
30+ end )
31+ end
32+
3733 context 'when the source path ends with `_spec.rb`' do
3834 it 'registers an offense' do
3935 expect_offense ( <<-RUBY , 'foo_spec.rb' )
You can’t perform that action at this time.
0 commit comments