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
03f74a31
Commit
03f74a31
authored
Oct 10, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create BoardAssignee model and set has_one relation
parent
c197361d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
2 deletions
+28
-2
app/models/board_assignee.rb
app/models/board_assignee.rb
+7
-0
ee/app/models/ee/board.rb
ee/app/models/ee/board.rb
+6
-1
spec/models/board_assignee_spec.rb
spec/models/board_assignee_spec.rb
+13
-0
spec/models/board_spec.rb
spec/models/board_spec.rb
+2
-1
No files found.
app/models/board_assignee.rb
0 → 100644
View file @
03f74a31
class
BoardAssignee
<
ActiveRecord
::
Base
belongs_to
:board
belongs_to
:assignee
,
class_name:
'User'
validates
:board
,
presence:
true
validates
:assignee
,
presence:
true
end
ee/app/models/ee/board.rb
View file @
03f74a31
...
...
@@ -5,9 +5,14 @@ module EE
prepended
do
belongs_to
:group
belongs_to
:milestone
belongs_to
:assignee
,
class_name:
'User'
has_many
:board_labels
# These can safely be changed to has_many when we support
# multiple assignees on the board configuration.
has_one
:board_assignee
has_one
:assignee
,
through: :board_assignee
has_many
:labels
,
through: :board_labels
validates
:name
,
presence:
true
...
...
spec/models/board_assignee_spec.rb
0 → 100644
View file @
03f74a31
require
'spec_helper'
describe
BoardAssignee
do
describe
'relationships'
do
it
{
is_expected
.
to
belong_to
(
:board
)
}
it
{
is_expected
.
to
belong_to
(
:assignee
).
class_name
(
'User'
)
}
end
describe
'validations'
do
it
{
is_expected
.
to
validate_presence_of
(
:board
)
}
it
{
is_expected
.
to
validate_presence_of
(
:assignee
)
}
end
end
spec/models/board_spec.rb
View file @
03f74a31
...
...
@@ -4,7 +4,8 @@ describe Board do
describe
'relationships'
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
belong_to
(
:milestone
)
}
it
{
is_expected
.
to
belong_to
(
:assignee
).
class_name
(
'User'
)
}
it
{
is_expected
.
to
have_one
(
:board_assignee
)
}
it
{
is_expected
.
to
have_one
(
:assignee
).
through
(
:board_assignee
)
}
it
{
is_expected
.
to
have_many
(
:board_labels
)
}
it
{
is_expected
.
to
have_many
(
:labels
).
through
(
:board_labels
)
}
...
...
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