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
c02ba468
Commit
c02ba468
authored
Dec 03, 2021
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing specs for run_after_commit_or_now
parent
d6502836
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
7 deletions
+43
-7
spec/models/concerns/after_commit_queue_spec.rb
spec/models/concerns/after_commit_queue_spec.rb
+43
-7
No files found.
spec/models/concerns/after_commit_queue_spec.rb
View file @
c02ba468
...
@@ -3,15 +3,51 @@
...
@@ -3,15 +3,51 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
AfterCommitQueue
do
RSpec
.
describe
AfterCommitQueue
do
it
'runs after transaction is committed'
do
describe
'#run_after_commit'
do
called
=
false
it
'runs after transaction is committed'
do
test_proc
=
proc
{
called
=
true
}
called
=
false
test_proc
=
proc
{
called
=
true
}
project
=
build
(
:project
)
project
=
build
(
:project
)
project
.
run_after_commit
(
&
test_proc
)
project
.
run_after_commit
(
&
test_proc
)
project
.
save!
project
.
save!
expect
(
called
).
to
be
true
expect
(
called
).
to
be
true
end
end
describe
'#run_after_commit_or_now'
do
it
'runs immediately if not within a transction'
do
called
=
false
test_proc
=
proc
{
called
=
true
}
project
=
build
(
:project
)
project
.
run_after_commit_or_now
(
&
test_proc
)
expect
(
called
).
to
be
true
end
it
'runs after transaction has completed'
do
called
=
false
test_proc
=
proc
{
called
=
true
}
project
=
build
(
:project
)
Project
.
transaction
do
# Add this record to the current transaction so that after commit hooks
# are called
Project
.
connection
.
add_transaction_record
(
project
)
project
.
run_after_commit_or_now
(
&
test_proc
)
project
.
save!
expect
(
called
).
to
be
false
end
expect
(
called
).
to
be
true
end
end
end
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