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
5bd9b9ea
Commit
5bd9b9ea
authored
Sep 09, 2021
by
Thong Kuah
Committed by
Marcia Ramos
Sep 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document let_it_be limitation with stubs
parent
fb2d7b3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
doc/development/testing_guide/best_practices.md
doc/development/testing_guide/best_practices.md
+6
-0
No files found.
doc/development/testing_guide/best_practices.md
View file @
5bd9b9ea
...
@@ -661,6 +661,12 @@ let_it_be_with_refind(:project) { create(:project) }
...
@@ -661,6 +661,12 @@ let_it_be_with_refind(:project) { create(:project) }
let_it_be
(
:project
,
refind:
true
)
{
create
(
:project
)
}
let_it_be
(
:project
,
refind:
true
)
{
create
(
:project
)
}
```
```
Note that
`let_it_be`
cannot be used with factories that has stubs, such as
`allow`
.
The reason is that
`let_it_be`
happens in a
`before(:all)`
block, and RSpec does not
allow stubs in
`before(:all)`
.
See this
[
issue
](
https://gitlab.com/gitlab-org/gitlab/-/issues/340487
)
for more details.
To resolve, use
`let`
, or change the factory to not use stubs.
### Time-sensitive tests
### Time-sensitive tests
[
`ActiveSupport::Testing::TimeHelpers`
](
https://api.rubyonrails.org/v6.0.3.1/classes/ActiveSupport/Testing/TimeHelpers.html
)
[
`ActiveSupport::Testing::TimeHelpers`
](
https://api.rubyonrails.org/v6.0.3.1/classes/ActiveSupport/Testing/TimeHelpers.html
)
...
...
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