Skip to content

#34997 - post receive spec

Alex Kalderimis requested to merge ajk-post-receive-spec-remove-any-mocks into master

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

Availability and Testing

Edited by Alex Kalderimis

Merge request reports