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
7d81e0a7
Commit
7d81e0a7
authored
Dec 03, 2021
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test run_after_commit that is run after transaction
parent
c02ba468
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
spec/models/concerns/after_commit_queue_spec.rb
spec/models/concerns/after_commit_queue_spec.rb
+21
-1
No files found.
spec/models/concerns/after_commit_queue_spec.rb
View file @
7d81e0a7
...
...
@@ -4,15 +4,35 @@ require 'spec_helper'
RSpec
.
describe
AfterCommitQueue
do
describe
'#run_after_commit'
do
it
'runs after record is saved'
do
called
=
false
test_proc
=
proc
{
called
=
true
}
project
=
build
(
:project
)
project
.
run_after_commit
(
&
test_proc
)
expect
(
called
).
to
be
false
# save! is run in its own transaction
project
.
save!
expect
(
called
).
to
be
true
end
it
'runs after transaction is committed'
do
called
=
false
test_proc
=
proc
{
called
=
true
}
project
=
build
(
:project
)
Project
.
transaction
do
project
.
run_after_commit
(
&
test_proc
)
project
.
save!
expect
(
called
).
to
be
false
end
expect
(
called
).
to
be
true
end
end
...
...
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