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
02699f26
Commit
02699f26
authored
Feb 23, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic specs for optimistic locking mixin
parent
ed986806
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
spec/lib/gitlab/optimistic_locking_spec.rb
spec/lib/gitlab/optimistic_locking_spec.rb
+16
-3
No files found.
spec/lib/gitlab/optimistic_locking_spec.rb
View file @
02699f26
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
OptimisticLocking
,
lib:
true
do
describe
Gitlab
::
OptimisticLocking
,
lib:
true
do
describe
'#retry_lock'
do
let!
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let!
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let!
(
:pipeline2
)
{
Ci
::
Pipeline
.
find
(
pipeline
.
id
)
}
let!
(
:pipeline2
)
{
Ci
::
Pipeline
.
find
(
pipeline
.
id
)
}
describe
'#retry_lock'
do
it
'does not reload object if state changes'
do
it
'does not reload object if state changes'
do
expect
(
pipeline
).
not_to
receive
(
:reload
)
expect
(
pipeline
).
not_to
receive
(
:reload
)
expect
(
pipeline
).
to
receive
(
:succeed
).
and_call_original
expect
(
pipeline
).
to
receive
(
:succeed
).
and_call_original
...
@@ -36,4 +36,17 @@ describe Gitlab::OptimisticLocking, lib: true do
...
@@ -36,4 +36,17 @@ describe Gitlab::OptimisticLocking, lib: true do
end
.
to
raise_error
(
ActiveRecord
::
StaleObjectError
)
end
.
to
raise_error
(
ActiveRecord
::
StaleObjectError
)
end
end
end
end
describe
'#retry_optimistic_lock'
do
context
'when locking module is mixed in'
do
let
(
:unlockable
)
do
Class
.
new
.
include
(
described_class
).
new
end
it
'is an alias for retry_lock'
do
expect
(
unlockable
.
method
(
:retry_optimistic_lock
))
.
to
eq
unlockable
.
method
(
:retry_lock
)
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