Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cf8d8a84
Commit
cf8d8a84
authored
Oct 10, 2019
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs Gotchas: Add allow_next_instance_of example
parent
9fcc3630
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
doc/development/gotchas.md
doc/development/gotchas.md
+8
-2
No files found.
doc/development/gotchas.md
View file @
cf8d8a84
...
...
@@ -113,6 +113,8 @@ 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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment