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
d4a5d8d0
Commit
d4a5d8d0
authored
Feb 14, 2019
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for issuable states sync
parent
37741c59
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
app/models/concerns/issuable_states.rb
app/models/concerns/issuable_states.rb
+1
-0
spec/models/concerns/issuable_states_spec.rb
spec/models/concerns/issuable_states_spec.rb
+30
-0
No files found.
app/models/concerns/issuable_states.rb
View file @
d4a5d8d0
...
...
@@ -4,6 +4,7 @@ module IssuableStates
# The state:string column is being migrated to state_id:integer column
# This is a temporary hook to populate state_id column with new values
# and can be removed after the state column is removed.
# Check https://gitlab.com/gitlab-org/gitlab-ce/issues/51789 for more information
included
do
before_save
:set_state_id
end
...
...
spec/models/concerns/issuable_states_spec.rb
0 → 100644
View file @
d4a5d8d0
# frozen_string_literal: true
require
'spec_helper'
# This spec checks if state_id column of issues and merge requests
# are being synced on every save.
# It can be removed in the next release. Check https://gitlab.com/gitlab-org/gitlab-ce/issues/51789 for more information.
describe
IssuableStates
do
[
Issue
,
MergeRequest
].
each
do
|
klass
|
it
"syncs state_id column when
#{
klass
.
model_name
.
human
}
gets created"
do
klass
.
available_states
.
each
do
|
state
,
state_id
|
issuable
=
build
(
klass
.
model_name
.
param_key
,
state:
state
.
to_s
)
issuable
.
save!
expect
(
issuable
.
state_id
).
to
eq
(
state_id
)
end
end
it
"syncs state_id column when
#{
klass
.
model_name
.
human
}
gets updated"
do
klass
.
available_states
.
each
do
|
state
,
state_id
|
issuable
=
create
(
klass
.
model_name
.
param_key
,
state:
state
.
to_s
)
issuable
.
update
(
state:
state
)
expect
(
issuable
.
state_id
).
to
eq
(
state_id
)
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