Skip to content

Commit

Permalink
Merge pull request #2819 from rspec/skips-for-monkey-patching-removal
Browse files Browse the repository at this point in the history
Skip config dependant specs
  • Loading branch information
JonRowe authored Dec 26, 2020
2 parents 8412611 + 052479f commit 46292a3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions spec/rspec/core/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def mod.configuration; @config ||= Struct.new(:custom_setting).new; end
it_behaves_like "a configurable framework adapter", :mock_with

it "allows rspec-mocks to be configured with a provided block" do
skip unless RSpec::Mocks.configuration.respond_to?(:add_stub_and_should_receive_to)
mod = Module.new

expect(RSpec::Mocks.configuration).to receive(:add_stub_and_should_receive_to).with(mod)
Expand Down Expand Up @@ -2724,9 +2725,13 @@ def strategy.order(list)
def in_fully_monkey_patched_rspec_environment
in_sub_process do
config.expose_dsl_globally = true
mocks.configuration.syntax = [:expect, :should]
if mocks.configuration.respond_to?(:syntax)
mocks.configuration.syntax = [:expect, :should]
end
mocks.configuration.patch_marshal_to_support_partial_doubles = true
expectations.configuration.syntax = [:expect, :should]
if expectations.configuration.respond_to?(:syntax)
expectations.configuration.syntax = [:expect, :should]
end

yield
end
Expand All @@ -2742,6 +2747,7 @@ def in_fully_monkey_patched_rspec_environment
end

it 'stops using should syntax for expectations' do
skip unless expectations.configuration.respond_to?(:syntax)
in_fully_monkey_patched_rspec_environment do
obj = Object.new
config.expect_with :rspec
Expand All @@ -2752,6 +2758,7 @@ def in_fully_monkey_patched_rspec_environment
end

it 'stops using should syntax for mocks' do
skip unless mocks.configuration.respond_to?(:syntax)
in_fully_monkey_patched_rspec_environment do
obj = Object.new
config.mock_with :rspec
Expand Down Expand Up @@ -2781,6 +2788,7 @@ def emulate_not_configured_mock_framework
end

it 'disables monkey patching after example groups being configured' do
skip unless mocks.configuration.respond_to?(:syntax)
emulate_not_configured_mock_framework do
obj = Object.new
config.disable_monkey_patching!
Expand All @@ -2804,6 +2812,7 @@ def emulate_not_configured_expectation_framework
end

it 'disables monkey patching after example groups being configured' do
skip unless expectations.configuration.respond_to?(:syntax)
emulate_not_configured_expectation_framework do
obj = Object.new
config.disable_monkey_patching!
Expand Down

0 comments on commit 46292a3

Please sign in to comment.