From e36698af56e287aa9310762937d28ed282564207 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Sun, 14 Mar 2021 23:17:26 +0300 Subject: [PATCH] Adjust specs to be deprecation warning-free --- spec/integration/bisect_runners_spec.rb | 3 +-- spec/rspec/core/formatters/profile_formatter_spec.rb | 4 ++-- spec/rspec/core/memoized_helpers_spec.rb | 6 +++--- spec/spec_helper.rb | 1 - spec/support/aruba_support.rb | 3 --- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/spec/integration/bisect_runners_spec.rb b/spec/integration/bisect_runners_spec.rb index e40f0e0759..ade339f354 100644 --- a/spec/integration/bisect_runners_spec.rb +++ b/spec/integration/bisect_runners_spec.rb @@ -53,8 +53,7 @@ def with_runner(&block) it 'honors `run_all_when_everything_filtered`' do write_file 'spec/a_spec.rb', " RSpec.configure do |c| - c.filter_run :focus - c.run_all_when_everything_filtered = true + c.filter_run_when_matching :focus end RSpec.describe 'A group' do diff --git a/spec/rspec/core/formatters/profile_formatter_spec.rb b/spec/rspec/core/formatters/profile_formatter_spec.rb index 9009b181aa..5c7f9838b8 100644 --- a/spec/rspec/core/formatters/profile_formatter_spec.rb +++ b/spec/rspec/core/formatters/profile_formatter_spec.rb @@ -46,7 +46,7 @@ def profile *groups end) end - it_should_behave_like "profiles examples" + it_behaves_like "profiles examples" it "doesn't profile a single example group" do expect(formatter_output.string).not_to match(/slowest example groups/) @@ -72,7 +72,7 @@ def profile *groups profile group1, group2 end - it_should_behave_like "profiles examples" + it_behaves_like "profiles examples" it "prints the slowest example groups" do expect(formatter_output.string).to match(/slowest example groups/) diff --git a/spec/rspec/core/memoized_helpers_spec.rb b/spec/rspec/core/memoized_helpers_spec.rb index 4a96d3b25e..0b220c3c95 100644 --- a/spec/rspec/core/memoized_helpers_spec.rb +++ b/spec/rspec/core/memoized_helpers_spec.rb @@ -633,17 +633,17 @@ def hello_message; "Hello from module"; end describe Object do context 'with implicit subject' do - it_should_behave_like 'a subject' + it_behaves_like 'a subject' end context 'with explicit subject' do subject { Object.new } - it_should_behave_like 'a subject' + it_behaves_like 'a subject' end context 'with a constant subject'do subject { 123 } - it_should_behave_like 'a subject' + it_behaves_like 'a subject' end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index da6f4f1975..9e4a3a5231 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -81,7 +81,6 @@ def handle_current_dir_change # runtime options c.raise_errors_for_deprecations! - c.color = true c.include CommonHelpers c.expect_with :rspec do |expectations| diff --git a/spec/support/aruba_support.rb b/spec/support/aruba_support.rb index 5f8383f2db..9ef959d669 100644 --- a/spec/support/aruba_support.rb +++ b/spec/support/aruba_support.rb @@ -35,8 +35,6 @@ module ArubaLoader attr_reader :last_cmd_stdout, :last_cmd_stderr, :last_cmd_exit_status def run_command(cmd) - RSpec.configuration.color = true - temp_stdout = StringIO.new temp_stderr = StringIO.new @@ -51,7 +49,6 @@ def run_command(cmd) end ensure RSpec.reset - RSpec.configuration.color = true # Ensure it gets cached with a proper value -- if we leave it set to nil, # and the next spec operates in a different dir, it could get set to an