Skip to content

Commit a0594fa

Browse files
committed
Fix RSpec 4 shared context inclusion
Starting from RSpec 4, the implicit shared context inclusion, when a shared context would have been included to an example if the example has matching metadata, is not the case anymore. See: - rspec/rspec-core#2834 - rspec/rspec-core#2832 - rspec/rspec-core#2878
1 parent 8cd4229 commit a0594fa

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

spec/rubocop/cli/autocorrect_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# frozen_string_literal: true
22

3-
RSpec.describe 'RuboCop::CLI --autocorrect', :isolated_environment do # rubocop:disable RSpec/DescribeClass
3+
RSpec.describe 'RuboCop::CLI --autocorrect' do # rubocop:disable RSpec/DescribeClass
44
subject(:cli) { RuboCop::CLI.new }
55

6+
include_context 'isolated environment'
7+
68
include_context 'when cli spec behavior'
79

810
context 'when corrects `RSpec/Capybara/CurrentPathExpectation` with ' \

spec/spec_helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ module SpecHelper
3434
config.raise_on_warning = true
3535

3636
config.include(ExpectOffense)
37+
38+
config.include_context 'with default RSpec/Language config', :config
39+
config.include_context 'config', :config
3740
end
3841

3942
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

0 commit comments

Comments
 (0)