diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/support/helpers/next_instance_of.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/support/helpers/next_instance_of.rb')
-rw-r--r-- | spec/support/helpers/next_instance_of.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/support/helpers/next_instance_of.rb b/spec/support/helpers/next_instance_of.rb index 95d8936588c..461d411a5ce 100644 --- a/spec/support/helpers/next_instance_of.rb +++ b/spec/support/helpers/next_instance_of.rb @@ -22,9 +22,15 @@ module NextInstanceOf def stub_new(target, number, ordered = false, *new_args, &blk) receive_new = receive(:new) receive_new.ordered if ordered - receive_new.exactly(number).times if number receive_new.with(*new_args) if new_args.any? + if number.is_a?(Range) + receive_new.at_least(number.begin).times if number.begin + receive_new.at_most(number.end).times if number.end + elsif number + receive_new.exactly(number).times + end + target.to receive_new.and_wrap_original do |method, *original_args| method.call(*original_args).tap(&blk) end |