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
6d1fca0e
Commit
6d1fca0e
authored
Jul 18, 2018
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update page epic init data to include new date fields
parent
bad81180
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
5 deletions
+37
-5
ee/app/helpers/epics_helper.rb
ee/app/helpers/epics_helper.rb
+12
-0
ee/spec/helpers/epics_helper_spec.rb
ee/spec/helpers/epics_helper_spec.rb
+25
-5
No files found.
ee/app/helpers/epics_helper.rb
View file @
6d1fca0e
...
...
@@ -16,11 +16,23 @@ module EpicsHelper
todo_exists:
todo
.
present?
,
todo_path:
group_todos_path
(
group
),
start_date:
epic
.
start_date
,
due_date:
epic
.
due_date
,
end_date:
epic
.
end_date
}
epic_meta
[
:todo_delete_path
]
=
dashboard_todo_path
(
todo
)
if
todo
.
present?
if
Ability
.
allowed?
(
current_user
,
:update_epic
,
epic
.
group
)
epic_meta
.
merge!
(
start_date_fixed:
epic
.
start_date_fixed
,
start_date_is_fixed:
epic
.
start_date_is_fixed?
,
start_date_from_milestones:
epic
.
start_date_from_milestones
,
due_date_fixed:
epic
.
due_date_fixed
,
due_date_is_fixed:
epic
.
due_date_is_fixed?
,
due_date_from_milestones:
epic
.
due_date_from_milestones
)
end
participants
=
UserSerializer
.
new
.
represent
(
epic
.
participants
)
initial
=
opts
[
:initial
].
merge
(
labels:
epic
.
labels
,
participants:
participants
,
...
...
ee/spec/helpers/epics_helper_spec.rb
View file @
6d1fca0e
...
...
@@ -4,18 +4,21 @@ describe EpicsHelper do
include
ApplicationHelper
describe
'#epic_show_app_data'
do
it
'returns the correct json'
do
user
=
create
(
:user
)
@epic
=
create
(
:epic
,
author:
user
)
let
(
:user
)
{
create
(
:user
)
}
let!
(
:epic
)
{
create
(
:epic
,
author:
user
)
}
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
stub_licensed_features
(
epics:
true
)
end
data
=
helper
.
epic_show_app_data
(
@epic
,
initial:
{},
author_icon:
'icon_path'
)
it
'returns the correct json'
do
data
=
helper
.
epic_show_app_data
(
epic
,
initial:
{},
author_icon:
'icon_path'
)
meta_data
=
JSON
.
parse
(
data
[
:meta
])
expected_keys
=
%i(initial meta namespace labels_path toggle_subscription_path labels_web_url epics_web_url)
expect
(
data
.
keys
).
to
match_array
(
expected_keys
)
expect
(
meta_data
.
keys
).
to
match_array
(
%w[created author start_date end_date epic_id todo_exists todo_path]
)
expect
(
meta_data
.
keys
).
to
match_array
(
%w[created author start_date end_date
due_date
epic_id todo_exists todo_path]
)
expect
(
meta_data
[
'author'
]).
to
eq
({
'name'
=>
user
.
name
,
'url'
=>
"/
#{
user
.
username
}
"
,
...
...
@@ -23,6 +26,23 @@ describe EpicsHelper do
'src'
=>
'icon_path'
})
end
context
'when user has edit permission'
do
before
do
epic
.
group
.
add_developer
(
user
)
end
it
'returns extra date fields if user can edit'
do
data
=
helper
.
epic_show_app_data
(
epic
,
initial:
{},
author_icon:
'icon_path'
)
meta_data
=
JSON
.
parse
(
data
[
:meta
])
expect
(
meta_data
.
keys
).
to
match_array
(
%w[
created author
start_date start_date_fixed start_date_is_fixed start_date_from_milestones
end_date due_date due_date_fixed due_date_is_fixed due_date_from_milestones
]
)
end
end
end
describe
'#epic_endpoint_query_params'
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