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
2c9e5d45
Commit
2c9e5d45
authored
Aug 10, 2021
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change `group` association to `namespace`
This is more accurate, as it can reference a top-level namespace.
parent
baddf97e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
app/models/work_item/type.rb
app/models/work_item/type.rb
+1
-1
spec/factories/work_item/work_item_types.rb
spec/factories/work_item/work_item_types.rb
+5
-1
spec/models/work_item/type_spec.rb
spec/models/work_item/type_spec.rb
+1
-1
No files found.
app/models/work_item/type.rb
View file @
2c9e5d45
...
@@ -13,7 +13,7 @@ class WorkItem::Type < ApplicationRecord
...
@@ -13,7 +13,7 @@ class WorkItem::Type < ApplicationRecord
enum
base_type:
Issue
.
issue_types
enum
base_type:
Issue
.
issue_types
belongs_to
:
group
,
foreign_key: :namespace_id
,
optional:
true
belongs_to
:
namespace
,
optional:
true
has_many
:work_items
,
class_name:
'Issue'
,
foreign_key: :work_item_type_id
,
inverse_of: :work_item_type
has_many
:work_items
,
class_name:
'Issue'
,
foreign_key: :work_item_type_id
,
inverse_of: :work_item_type
before_validation
:strip_whitespace
before_validation
:strip_whitespace
...
...
spec/factories/work_item/work_item_types.rb
View file @
2c9e5d45
...
@@ -2,10 +2,14 @@
...
@@ -2,10 +2,14 @@
FactoryBot
.
define
do
FactoryBot
.
define
do
factory
:work_item_type
,
class:
'WorkItem::Type'
do
factory
:work_item_type
,
class:
'WorkItem::Type'
do
group
namespace
name
{
generate
(
:work_item_type_name
)
}
name
{
generate
(
:work_item_type_name
)
}
icon_name
{
'issue'
}
icon_name
{
'issue'
}
base_type
{
Issue
.
issue_types
[
'issue'
]
}
base_type
{
Issue
.
issue_types
[
'issue'
]
}
trait
:default
do
namespace
{
nil
}
end
end
end
end
end
spec/models/work_item/type_spec.rb
View file @
2c9e5d45
...
@@ -9,7 +9,7 @@ RSpec.describe WorkItem::Type do
...
@@ -9,7 +9,7 @@ RSpec.describe WorkItem::Type do
describe
'associations'
do
describe
'associations'
do
it
{
is_expected
.
to
have_many
(
:work_items
).
with_foreign_key
(
'work_item_type_id'
)
}
it
{
is_expected
.
to
have_many
(
:work_items
).
with_foreign_key
(
'work_item_type_id'
)
}
it
{
is_expected
.
to
belong_to
(
:
group
).
with_foreign_key
(
'namespace_id'
)
}
it
{
is_expected
.
to
belong_to
(
:
namespace
)
}
end
end
describe
'#destroy'
do
describe
'#destroy'
do
...
...
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