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
8a5b4e2f
Commit
8a5b4e2f
authored
Apr 24, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RelatedIssue model
parent
c2c2628b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
app/models/related_issue.rb
app/models/related_issue.rb
+9
-0
spec/models/related_issue_spec.rb
spec/models/related_issue_spec.rb
+16
-0
No files found.
app/models/related_issue.rb
0 → 100644
View file @
8a5b4e2f
class
RelatedIssue
<
ActiveRecord
::
Base
belongs_to
:issue
belongs_to
:related_issue
,
class_name:
'Issue'
validates
:issue
,
presence:
true
,
uniqueness:
{
scope: :related_issue_id
}
validates
:related_issue
,
presence:
true
validates
:issue_id
,
uniqueness:
{
scope: :related_issue_id
}
end
\ No newline at end of file
spec/models/related_issue_spec.rb
0 → 100644
View file @
8a5b4e2f
require
'spec_helper'
describe
RelatedIssue
do
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
(
:issue
)
}
it
{
is_expected
.
to
belong_to
(
:related_issue
).
class_name
(
'Issue'
)
}
end
describe
"Validation"
do
subject
{
build
:related_issue
}
it
{
is_expected
.
to
validate_presence_of
(
:issue
)
}
it
{
is_expected
.
to
validate_presence_of
(
:related_issue
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:issue_id
).
scoped_to
(
:related_issue_id
)
}
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