diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-12 00:05:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-12 00:05:59 +0300 |
commit | ac062237da66db75b22f5dab2cc5766ee62a44d1 (patch) | |
tree | ae5a7eb248ddbf5c8c32c29a269127a936356364 /doc/development/gotchas.md | |
parent | 0dfbcd8f8b1587a7e10eb79940a8dc13bd72c664 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/gotchas.md')
-rw-r--r-- | doc/development/gotchas.md | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/development/gotchas.md b/doc/development/gotchas.md index 32efef2a9b3..5557a113d05 100644 --- a/doc/development/gotchas.md +++ b/doc/development/gotchas.md @@ -106,13 +106,15 @@ end Using `any_instance` to stub a method (elasticsearch_indexing) that has been defined on a prepended module (EE::ApplicationSetting) is not supported. ``` -### Alternative: `expect_next_instance_of` +### Alternative: `expect_next_instance_of` or `allow_next_instance_of` Instead of writing: ```ruby # Don't do this: expect_any_instance_of(Project).to receive(:add_import_job) + +allow_any_instance_of(Project).to receive(:add_import_job) ``` We could write: @@ -122,10 +124,14 @@ We could write: expect_next_instance_of(Project) do |project| expect(project).to receive(:add_import_job) end + +allow_next_instance_of(Project) do |project| + allow(project).to receive(:add_import_job) +end ``` -If we also want to expect the instance was initialized with some particular -arguments, we could also pass it to `expect_next_instance_of` like: +If we also want to initialized the instance with some particular arguments, we +could also pass it like: ```ruby # Do this: |