Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2988 from rspec/fix-configuration-options-ruby-3-2
Browse files Browse the repository at this point in the history
Fix configuration_options_spec on Ruby 3.2
  • Loading branch information
JonRowe committed Dec 12, 2022
1 parent d147546 commit 1d94593
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions spec/rspec/core/configuration_options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

opts.configure(configuration)

expect(configuration).to have_received(:force).with(:deprecation_stream => "path/to/log").ordered
expect(configuration).to have_received(:force).with({:deprecation_stream => "path/to/log"}).ordered
expect(configuration).to have_received(:requires=).ordered
end

Expand All @@ -39,8 +39,8 @@

opts.configure(configuration)

expect(configuration).to have_received(:force).with(:deprecation_stream => "path/to/log").ordered
expect(filter_manager).to have_received(:include).with(:foo => true).ordered
expect(configuration).to have_received(:force).with({:deprecation_stream => "path/to/log"}).ordered
expect(filter_manager).to have_received(:include).with({:foo => true}).ordered
end

it "configures deprecation_stream before configuring formatters" do
Expand All @@ -49,7 +49,7 @@

opts.configure(configuration)

expect(configuration).to have_received(:force).with(:deprecation_stream => "path/to/log").ordered
expect(configuration).to have_received(:force).with({:deprecation_stream => "path/to/log"}).ordered
expect(configuration).to have_received(:add_formatter).ordered
end

Expand Down Expand Up @@ -79,7 +79,7 @@

it "sets default_path before loading specs" do
opts = config_options_object(*%w[--default-path spec])
expect(config).to receive(:force).with(:default_path => 'spec').ordered
expect(config).to receive(:force).with({:default_path => 'spec'}).ordered
expect(config).to receive(:get_files_to_run).ordered
opts.configure(config)
config.files_to_run
Expand All @@ -94,31 +94,31 @@

it "sets default_path before `files_or_directories_to_run` since it relies on it" do
opts = config_options_object(*%w[--default-path spec])
expect(config).to receive(:force).with(:default_path => 'spec').ordered
expect(config).to receive(:force).with({:default_path => 'spec'}).ordered
expect(config).to receive(:files_or_directories_to_run=).ordered
opts.configure(config)
end

it 'configures the seed (via `order`) before requires so that required files can use the configured seed' do
opts = config_options_object(*%w[ --seed 1234 --require spec_helper ])

expect(config).to receive(:force).with(:order => "rand:1234").ordered
expect(config).to receive(:force).with({:order => "rand:1234"}).ordered
expect(config).to receive(:requires=).ordered

opts.configure(config)
end

it 'configures `only_failures` before `files_or_directories_to_run` since it affects loaded files' do
opts = config_options_object(*%w[ --only-failures ])
expect(config).to receive(:force).with(:only_failures => true).ordered
expect(config).to receive(:force).with({:only_failures => true}).ordered
expect(config).to receive(:files_or_directories_to_run=).ordered
opts.configure(config)
end

{ "pattern" => :pattern, "exclude-pattern" => :exclude_pattern }.each do |flag, attr|
it "sets #{attr} before `requires` so users can check `files_to_run` in a `spec_helper` loaded by `--require`" do
opts = config_options_object(*%W[--require spec_helpe --#{flag} **/*.spec])
expect(config).to receive(:force).with(attr => '**/*.spec').ordered
expect(config).to receive(:force).with({attr => '**/*.spec'}).ordered
expect(config).to receive(:requires=).ordered
opts.configure(config)
end
Expand All @@ -138,20 +138,20 @@

it "forces color" do
opts = config_options_object(*%w[--color])
expect(config).to receive(:force).with(:color => true)
expect(config).to receive(:force).with(:color_mode => :automatic)
expect(config).to receive(:force).with({:color => true})
expect(config).to receive(:force).with({:color_mode => :automatic})
opts.configure(config)
end

it "forces force_color" do
opts = config_options_object(*%w[--force-color])
expect(config).to receive(:force).with(:color_mode => :on)
expect(config).to receive(:force).with({:color_mode => :on})
opts.configure(config)
end

it "forces no_color" do
opts = config_options_object(*%w[--no-color])
expect(config).to receive(:force).with(:color_mode => :off)
expect(config).to receive(:force).with({:color_mode => :off})
opts.configure(config)
end

Expand Down Expand Up @@ -396,7 +396,7 @@
describe "default_path" do
it "gets set before files_or_directories_to_run" do
config = RSpec::Core::Configuration.new
expect(config).to receive(:force).with(:default_path => 'foo').ordered
expect(config).to receive(:force).with({:default_path => 'foo'}).ordered
expect(config).to receive(:get_files_to_run).ordered
opts = config_options_object("--default-path", "foo")
opts.configure(config)
Expand Down

0 comments on commit 1d94593

Please sign in to comment.