From 0e17986425d41e31dd25a576ea23e9a9cdfa3afa Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Thu, 15 Feb 2024 22:04:24 -0800 Subject: [PATCH 1/2] various: fix miscellaneous typos Signed-off-by: Patrick Linnane --- Changelog.md | 14 +++++++------- lib/rspec/mocks/configuration.rb | 2 +- lib/rspec/mocks/message_expectation.rb | 2 +- spec/rspec/mocks/once_counts_spec.rb | 2 +- spec/rspec/mocks/partial_double_spec.rb | 8 ++++---- .../mocks/stubbed_message_expectations_spec.rb | 4 ++-- spec/rspec/mocks/twice_counts_spec.rb | 2 +- .../mocks/verifying_doubles/construction_spec.rb | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Changelog.md b/Changelog.md index a4b28fb1f..8e86b6fe8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -66,7 +66,7 @@ Bug Fixes: * Remove empty diff marker when a diff only contains console codes. (Jon Rowe, #1506) * Show keyword vs hash diff marker when arguments are not `==` (Jon Rowe, #1506) * Change check to detect frozen objects to rescue errors rather than - pre-empting by checking `frozen?` due to some objects mis-behaving. + pre-empting by checking `frozen?` due to some objects misbehaving. (Keegan Roth, #1401) * Prevent unfulfilled expectations using `expect_any_instance_of` across a class inheritance boundary from raising rather than failing. (Jon Rowe, #1496) @@ -190,7 +190,7 @@ Bug Fixes: * Issue error when encountering invalid "counted" negative message expectations. (Sergiy Yarinovskiy, #1212) * Ensure `allow_any_instance_of` and `expect_any_instance_of` can be temporarily - supressed. (Jon Rowe, #1228) + suppressed. (Jon Rowe, #1228) * Ensure `expect_any_instance_of(double).to_not have_received(:some_method)` fails gracefully (as its not supported) rather than issuing a `NoMethodError`. (Maxim Krizhanovsky, #1231) @@ -287,7 +287,7 @@ Bug Fixes: `allow`. (Andrew Kozin, #1056) * Prevent stubbing `respond_to?` on partial doubles from causing infinite recursion. (Jon Rowe, #1013) -* Prevent aliased methods from disapearing after being mocked with +* Prevent aliased methods from disappearing after being mocked with `any_instance` (regression from #1043). (Joe Rafaniello, #1060) ### 3.4.1 / 2016-01-10 @@ -368,7 +368,7 @@ Bug Fixes: for when the message was received the wrong number of times with the specified args, and also received additional times with other arguments. Previously it confusingly listed the arguments as being - mis-matched (even when the double was allowed to receive with any + mismatched (even when the double was allowed to receive with any args) rather than listing the count. (John Ceh, #918) * Fix `any_args`/`anything` support so that we avoid calling `obj == anything` on user objects that may have improperly implemented `==` in a way that @@ -824,7 +824,7 @@ Deprecations: Deprecations * Expecting to use lambdas or other strong arity implementations for stub - methods with mis-matched arity is deprecated and support for them will be + methods with mismatched arity is deprecated and support for them will be removed in 3.0. Either provide the right amount of arguments or use a weak arity implementation (methods with splats or procs). (Jon Rowe) * Using the same test double instance in multiple examples is deprecated. Test @@ -898,7 +898,7 @@ Bug Fixes: double's nullness persisted between examples in earlier examples. While this is not an intended use case (test doubles are meant to live for only one example), we don't want to break behavior users rely - on in a minor relase. This will be deprecated in 2.99 and removed + on in a minor release. This will be deprecated in 2.99 and removed in 3.0. (Myron Marston) ### 2.14.0 / 2013-07-06 @@ -1023,7 +1023,7 @@ Bug fixes * Fix `stub_const` with an undefined constnat name to work properly with constant strings that are prefixed with `::` -- and edge case I missed in the bug fix in the 2.12.1 release (Myron Marston). -* Ensure method visibility on a partial mock is restored after reseting +* Ensure method visibility on a partial mock is restored after resetting method stubs, even on a singleton module (created via `extend self`) when the method visibility differs between the instance and singleton versions (Andy Lindeman). diff --git a/lib/rspec/mocks/configuration.rb b/lib/rspec/mocks/configuration.rb index 5962215f8..8496bdcc0 100644 --- a/lib/rspec/mocks/configuration.rb +++ b/lib/rspec/mocks/configuration.rb @@ -156,7 +156,7 @@ def verify_partial_doubles? end # @private - # Used to track wether we are temporarily suppressing verifying partial + # Used to track whether we are temporarily suppressing verifying partial # doubles with `without_partial_double_verification { ... }` attr_accessor :temporarily_suppress_partial_double_verification diff --git a/lib/rspec/mocks/message_expectation.rb b/lib/rspec/mocks/message_expectation.rb index 110e1cb07..8b21ae0be 100644 --- a/lib/rspec/mocks/message_expectation.rb +++ b/lib/rspec/mocks/message_expectation.rb @@ -101,7 +101,7 @@ def and_return(first_value, *values) # # allow(api).to receive(:get_foo).and_invoke(-> { raise ApiTimeout }, -> { raise ApiTimeout }, -> { :a_foo }) # api.get_foo # => raises ApiTimeout - # api.get_foo # => rasies ApiTimeout + # api.get_foo # => raises ApiTimeout # api.get_foo # => :a_foo # api.get_foo # => :a_foo # api.get_foo # => :a_foo diff --git a/spec/rspec/mocks/once_counts_spec.rb b/spec/rspec/mocks/once_counts_spec.rb index e65231fc7..81e1f3cb6 100644 --- a/spec/rspec/mocks/once_counts_spec.rb +++ b/spec/rspec/mocks/once_counts_spec.rb @@ -60,7 +60,7 @@ module Mocks # call with these args), but currently it fails with a confusing # message on verification, and ultimately we care more about # what the message is than when it is raised. Still, it would be - # preferrable for the error to be triggered on the first line, + # preferable for the error to be triggered on the first line, # so it'd be good to update this spec to enforce that once we # get the failure message right. @double.do_something(:args, 1) diff --git a/spec/rspec/mocks/partial_double_spec.rb b/spec/rspec/mocks/partial_double_spec.rb index 719041bdb..3272dbdf7 100644 --- a/spec/rspec/mocks/partial_double_spec.rb +++ b/spec/rspec/mocks/partial_double_spec.rb @@ -382,7 +382,7 @@ def defined_private_method expect(object.send(:defined_private_method)).to eq("works") end - it 'can be temporarily supressed' do + it 'can be temporarily suppressed' do without_partial_double_verification do expect(object).to receive(:fictitious_method) { 'works' } expect_any_instance_of(klass).to receive(:other_fictitious_method) { 'works' } @@ -395,7 +395,7 @@ def defined_private_method }.to raise_error RSpec::Mocks::MockExpectationError end - it 'can be temporarily supressed and nested' do + it 'can be temporarily suppressed and nested' do without_partial_double_verification do without_partial_double_verification do expect(object).to receive(:fictitious_method) { 'works' } @@ -410,7 +410,7 @@ def defined_private_method }.to raise_error RSpec::Mocks::MockExpectationError end - specify 'temporarily supressing partial doubles does not affect normal verifying doubles' do + specify 'temporarily suppressing partial doubles does not affect normal verifying doubles' do without_partial_double_verification do expect { instance_double(Class.new, :fictitious_method => 'works') @@ -471,7 +471,7 @@ def defined_private_method ) end - it 'can be temporarily supressed' do + it 'can be temporarily suppressed' do without_partial_double_verification do expect(subclass).to receive(:fictitious_method) { 'works' } end diff --git a/spec/rspec/mocks/stubbed_message_expectations_spec.rb b/spec/rspec/mocks/stubbed_message_expectations_spec.rb index 6e55adea8..c7e4514ad 100644 --- a/spec/rspec/mocks/stubbed_message_expectations_spec.rb +++ b/spec/rspec/mocks/stubbed_message_expectations_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe "expection set on previously stubbed method" do +RSpec.describe "expectation set on previously stubbed method" do it "fails if message is not received after expectation is set" do dbl = double(:msg => nil) dbl.msg @@ -40,7 +40,7 @@ verify dbl end - it 'indicates the site of expectation in the stacktrace when outputing arguments of similar calls' do + it 'indicates the site of expectation in the stacktrace when outputting arguments of similar calls' do dbl = double('double', :foo => true) expect(dbl).to receive(:foo).with('first'); line = __LINE__ diff --git a/spec/rspec/mocks/twice_counts_spec.rb b/spec/rspec/mocks/twice_counts_spec.rb index 8cb75ce14..48d07c072 100644 --- a/spec/rspec/mocks/twice_counts_spec.rb +++ b/spec/rspec/mocks/twice_counts_spec.rb @@ -76,7 +76,7 @@ module Mocks # call with these args), but currently it fails with a confusing # message on verification, and ultimately we care more about # what the message is than when it is raised. Still, it would be - # preferrable for the error to be triggered on the first line, + # preferable for the error to be triggered on the first line, # so it'd be good to update this spec to enforce that once we # get the failure message right. @double.do_something(:args, 1) diff --git a/spec/rspec/mocks/verifying_doubles/construction_spec.rb b/spec/rspec/mocks/verifying_doubles/construction_spec.rb index 4a5c7dde4..4371b6212 100644 --- a/spec/rspec/mocks/verifying_doubles/construction_spec.rb +++ b/spec/rspec/mocks/verifying_doubles/construction_spec.rb @@ -148,13 +148,13 @@ module CustomModule it 'prevents creation of instance doubles for unloaded constants' do expect { - instance_double('LoadedClas') + instance_double('LoadedClass') }.to raise_error(VerifyingDoubleNotDefinedError) end it 'prevents creation of class doubles for unloaded constants' do expect { - class_double('LoadedClas') + class_double('LoadedClass') }.to raise_error(VerifyingDoubleNotDefinedError) end end From 96088fb4ca4a28354dbde06c472bed2594be0761 Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Fri, 16 Feb 2024 09:31:57 -0800 Subject: [PATCH 2/2] revert Changelog & `LoadedClas` changes Signed-off-by: Patrick Linnane --- Changelog.md | 14 +++++++------- .../mocks/verifying_doubles/construction_spec.rb | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index 8e86b6fe8..a4b28fb1f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -66,7 +66,7 @@ Bug Fixes: * Remove empty diff marker when a diff only contains console codes. (Jon Rowe, #1506) * Show keyword vs hash diff marker when arguments are not `==` (Jon Rowe, #1506) * Change check to detect frozen objects to rescue errors rather than - pre-empting by checking `frozen?` due to some objects misbehaving. + pre-empting by checking `frozen?` due to some objects mis-behaving. (Keegan Roth, #1401) * Prevent unfulfilled expectations using `expect_any_instance_of` across a class inheritance boundary from raising rather than failing. (Jon Rowe, #1496) @@ -190,7 +190,7 @@ Bug Fixes: * Issue error when encountering invalid "counted" negative message expectations. (Sergiy Yarinovskiy, #1212) * Ensure `allow_any_instance_of` and `expect_any_instance_of` can be temporarily - suppressed. (Jon Rowe, #1228) + supressed. (Jon Rowe, #1228) * Ensure `expect_any_instance_of(double).to_not have_received(:some_method)` fails gracefully (as its not supported) rather than issuing a `NoMethodError`. (Maxim Krizhanovsky, #1231) @@ -287,7 +287,7 @@ Bug Fixes: `allow`. (Andrew Kozin, #1056) * Prevent stubbing `respond_to?` on partial doubles from causing infinite recursion. (Jon Rowe, #1013) -* Prevent aliased methods from disappearing after being mocked with +* Prevent aliased methods from disapearing after being mocked with `any_instance` (regression from #1043). (Joe Rafaniello, #1060) ### 3.4.1 / 2016-01-10 @@ -368,7 +368,7 @@ Bug Fixes: for when the message was received the wrong number of times with the specified args, and also received additional times with other arguments. Previously it confusingly listed the arguments as being - mismatched (even when the double was allowed to receive with any + mis-matched (even when the double was allowed to receive with any args) rather than listing the count. (John Ceh, #918) * Fix `any_args`/`anything` support so that we avoid calling `obj == anything` on user objects that may have improperly implemented `==` in a way that @@ -824,7 +824,7 @@ Deprecations: Deprecations * Expecting to use lambdas or other strong arity implementations for stub - methods with mismatched arity is deprecated and support for them will be + methods with mis-matched arity is deprecated and support for them will be removed in 3.0. Either provide the right amount of arguments or use a weak arity implementation (methods with splats or procs). (Jon Rowe) * Using the same test double instance in multiple examples is deprecated. Test @@ -898,7 +898,7 @@ Bug Fixes: double's nullness persisted between examples in earlier examples. While this is not an intended use case (test doubles are meant to live for only one example), we don't want to break behavior users rely - on in a minor release. This will be deprecated in 2.99 and removed + on in a minor relase. This will be deprecated in 2.99 and removed in 3.0. (Myron Marston) ### 2.14.0 / 2013-07-06 @@ -1023,7 +1023,7 @@ Bug fixes * Fix `stub_const` with an undefined constnat name to work properly with constant strings that are prefixed with `::` -- and edge case I missed in the bug fix in the 2.12.1 release (Myron Marston). -* Ensure method visibility on a partial mock is restored after resetting +* Ensure method visibility on a partial mock is restored after reseting method stubs, even on a singleton module (created via `extend self`) when the method visibility differs between the instance and singleton versions (Andy Lindeman). diff --git a/spec/rspec/mocks/verifying_doubles/construction_spec.rb b/spec/rspec/mocks/verifying_doubles/construction_spec.rb index 4371b6212..4a5c7dde4 100644 --- a/spec/rspec/mocks/verifying_doubles/construction_spec.rb +++ b/spec/rspec/mocks/verifying_doubles/construction_spec.rb @@ -148,13 +148,13 @@ module CustomModule it 'prevents creation of instance doubles for unloaded constants' do expect { - instance_double('LoadedClass') + instance_double('LoadedClas') }.to raise_error(VerifyingDoubleNotDefinedError) end it 'prevents creation of class doubles for unloaded constants' do expect { - class_double('LoadedClass') + class_double('LoadedClas') }.to raise_error(VerifyingDoubleNotDefinedError) end end