#34997 - post receive spec
What does this MR do?
This removes uses of expect_any_instance_of
and allow_any_instance_of
in favour of the more specific allow_next_instance_of
and expect_next_instance_of
, adding a new helper to make this easier, since they do not share the same API.
See: #34997 (closed)
New features:
A new helper is provided: AfterNextHelpers
This allows us to reduce boilerplate by replacing
expect_next_instance_of(SomeClass) do |instance|
expect(instance).to receive(:some_method).with(:x, :y).and_call_original
end
With:
expect_next(SomeClass).to receive(:some_method).with(:x, :y).and_call_original
This also supports allow
:
allow_next(SomeClass).to receive(:some_method).and_return(double)
A specialized helper is provided for the common case of expecting services to be called:
expect_execution_of(SomeService)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Edited by Alex Kalderimis