Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def hash_inspect(hash)
mocks.verify_partial_doubles = true
end

config.shared_context_metadata_behavior = :apply_to_host_groups if config.respond_to?(:shared_context_metadata_behavior=) # RSpec 4 dropped this setting
config.disable_monkey_patching! if config.respond_to?(:disable_monkey_patching!) # RSpec 4 dropped this method

# We don't want rspec-core to look in our `lib` for failure snippets.
Expand All @@ -59,7 +60,7 @@ def hash_inspect(hash)
config.project_source_dirs -= ["lib"]
end

RSpec.shared_context "with #should enabled", :uses_should do
RSpec.shared_context "with #should enabled" do
orig_syntax = nil

before(:all) do
Expand All @@ -83,10 +84,9 @@ def hash_inspect(hash)
after(:context) do
RSpec::Matchers.configuration.syntax = orig_syntax
end

end

RSpec.shared_context "with #should exclusively enabled", :uses_only_should do
RSpec.shared_context "with #should exclusively enabled" do
orig_syntax = nil

before(:context) do
Expand All @@ -107,12 +107,18 @@ def hash_inspect(hash)
end
end

RSpec.shared_context "with warn_about_potential_false_positives set to false", :warn_about_potential_false_positives do
RSpec.shared_context "with warn_about_potential_false_positives set to false" do
original_value = RSpec::Expectations.configuration.warn_about_potential_false_positives?

after(:context) { RSpec::Expectations.configuration.warn_about_potential_false_positives = original_value }
end

RSpec.configure do |config|
config.include_context "with #should enabled", :uses_should
config.include_context "with #should exclusively enabled", :uses_only_should
config.include_context "with warn_about_potential_false_positives set to false", :warn_about_potential_false_positives
end

module MinitestIntegration
include ::RSpec::Support::InSubProcess

Expand Down