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
f8a130b1
Commit
f8a130b1
authored
Oct 17, 2019
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add #to_ability_name to Project & Milestone
This will be used later for search filtering.
parent
ba8b47a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
0 deletions
+24
-0
app/models/milestone.rb
app/models/milestone.rb
+4
-0
app/models/project.rb
app/models/project.rb
+4
-0
spec/models/milestone_spec.rb
spec/models/milestone_spec.rb
+8
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+8
-0
No files found.
app/models/milestone.rb
View file @
f8a130b1
...
...
@@ -261,6 +261,10 @@ class Milestone < ApplicationRecord
group
||
project
end
def
to_ability_name
model_name
.
singular
end
def
group_milestone?
group_id
.
present?
end
...
...
app/models/project.rb
View file @
f8a130b1
...
...
@@ -1260,6 +1260,10 @@ class Project < ApplicationRecord
end
end
def
to_ability_name
model_name
.
singular
end
# rubocop: disable CodeReuse/ServiceClass
def
execute_hooks
(
data
,
hooks_scope
=
:push_hooks
)
run_after_commit_or_now
do
...
...
spec/models/milestone_spec.rb
View file @
f8a130b1
...
...
@@ -227,6 +227,14 @@ describe Milestone do
end
end
describe
'#to_ability_name'
do
it
'returns milestone'
do
milestone
=
build
(
:milestone
)
expect
(
milestone
.
to_ability_name
).
to
eq
(
'milestone'
)
end
end
describe
'.search'
do
let
(
:milestone
)
{
create
(
:milestone
,
title:
'foo'
,
description:
'bar'
)
}
...
...
spec/models/project_spec.rb
View file @
f8a130b1
...
...
@@ -4441,6 +4441,14 @@ describe Project do
end
end
describe
'#to_ability_name'
do
it
'returns project'
do
project
=
build
(
:project_empty_repo
)
expect
(
project
.
to_ability_name
).
to
eq
(
'project'
)
end
end
describe
'#execute_hooks'
do
let
(
:data
)
{
{
ref:
'refs/heads/master'
,
data:
'data'
}
}
it
'executes active projects hooks with the specified scope'
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