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
dc91d10c
Commit
dc91d10c
authored
Mar 09, 2020
by
Gary Holtz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creates an actual idempotency spec
parent
811e5eef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
app/services/merge_requests/squash_service.rb
app/services/merge_requests/squash_service.rb
+4
-0
spec/services/merge_requests/squash_service_spec.rb
spec/services/merge_requests/squash_service_spec.rb
+7
-0
No files found.
app/services/merge_requests/squash_service.rb
View file @
dc91d10c
...
...
@@ -4,6 +4,10 @@ module MergeRequests
class
SquashService
<
MergeRequests
::
BaseService
include
Git
::
Logger
def
idempotent?
true
end
def
execute
# If performing a squash would result in no change, then
# immediately return a success message without performing a squash
...
...
spec/services/merge_requests/squash_service_spec.rb
View file @
dc91d10c
...
...
@@ -140,6 +140,13 @@ describe MergeRequests::SquashService do
context
'when the merge request has already been merged'
do
let
(
:merge_request
)
{
merge_request_with_one_commit
}
it
'checks the side-effects for multiple calls'
do
merge_request
.
mark_as_merged
expect
(
service
).
to
be_idempotent
expect
{
IdempotentWorkerHelper
::
WORKER_EXEC_TIMES
.
times
{
service
.
execute
}
}.
not_to
raise_error
end
it
'idempotently returns a success'
do
merge_request
.
mark_as_merged
result
=
service
.
execute
...
...
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