Skip to content

Commit

Permalink
Fix RSpec 4 shared context inclusion
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pirj committed Jul 9, 2022
1 parent 8cd4229 commit 2b55e6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion spec/rubocop/cli/autocorrect_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

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

include_context 'isolated environment'

include_context 'when cli spec behavior'

context 'when corrects `RSpec/Capybara/CurrentPathExpectation` with ' \
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ module SpecHelper
config.raise_on_warning = true

config.include(ExpectOffense)

config.include_context 'with default RSpec/Language config', :config
config.include_context 'config', :config
config.include_context 'smoke test', type: :cop_spec
end

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

0 comments on commit 2b55e6a

Please sign in to comment.