BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2e3f0b08
Commit
2e3f0b08
authored
Jun 09, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old specs and add new ones
parent
673bc07c
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
39 deletions
+44
-39
milestone_actions.rb
app/controllers/concerns/milestone_actions.rb
+1
-1
milestoneish.rb
app/models/concerns/milestoneish.rb
+6
-2
milestone_tabs_spec.rb
spec/features/dashboard/milestone_tabs_spec.rb
+1
-1
milestones_spec.rb
spec/features/milestones/milestones_spec.rb
+0
-6
milestoneish_spec.rb
spec/models/concerns/milestoneish_spec.rb
+35
-0
group_milestone_spec.rb
spec/models/group_milestone_spec.rb
+1
-0
milestone_spec.rb
spec/models/milestone_spec.rb
+0
-29
No files found.
app/controllers/concerns/milestone_actions.rb
View file @
2e3f0b08
...
...
@@ -6,7 +6,7 @@ module MilestoneActions
format
.
html
{
redirect_to
milestone_redirect_path
}
format
.
json
do
render
json:
tabs_json
(
"shared/milestones/_merge_requests_tab"
,
{
merge_requests:
@milestone
.
merge_requests
.
sort
(
'priority'
)
,
merge_requests:
@milestone
.
sorted_merge_requests
,
show_project_name:
true
})
end
...
...
app/models/concerns/milestoneish.rb
View file @
2e3f0b08
...
...
@@ -62,12 +62,16 @@ module Milestoneish
due_date
&&
due_date
.
past?
end
def
sorted_merge_requests
merge_requests
.
sort
(
'label_priority'
)
end
private
def
count_issues_by_state
(
user
)
memoize_per_user
(
user
,
:count_issues_by_state
)
do
# Need to group and count using ruby array to not break
# label ordering
# label ordering
. Also it saves a SQL query.
issues_visible_to_user
(
user
).
to_a
.
group_by
(
&
:state
)
end
end
...
...
@@ -81,6 +85,6 @@ module Milestoneish
# override in a class that includes this module to get a faster query
# from IssuesFinder
def
issues_finder_params
{
sort:
'priority'
}
{
sort:
'
label_
priority'
}
end
end
spec/features/dashboard/milestone_tabs_spec.rb
View file @
2e3f0b08
...
...
@@ -23,7 +23,7 @@ describe 'Dashboard milestone tabs', :js, :feature do
it
'loads merge requests async'
do
click_link
'Merge Requests'
expect
(
page
).
to
have_selector
(
'.m
erge_requests-sortable
-list'
)
expect
(
page
).
to
have_selector
(
'.m
ilestone-merge_requests
-list'
)
end
it
'loads participants async'
do
...
...
spec/features/milestones/milestones_spec.rb
View file @
2e3f0b08
...
...
@@ -39,7 +39,6 @@
# expect(issue_target).to have_selector('.issuable-row')
# end
# end
>>>>>>>
Remove
Drag
and
drop
and
sorting
from
milestone
view
# context 'merge requests' do
# let(:merge_request) { page.find_by_id('merge_requests-list-unassigned').find('li') }
...
...
@@ -73,13 +72,8 @@
# end
# end
<<<<<<<
5
f42009f8dcc29d559ee415e92c88858e361f063
def
create_and_drag_issue
(
params
=
{})
@issue
=
create
(
:issue
,
params
.
merge
(
title:
'Foo'
,
project:
project
,
milestone:
milestone
))
=======
# def create_and_drag_issue(params = {})
# create(:issue, params.merge(title: 'Foo', project: project, milestone: milestone))
>>>>>>>
Remove
Drag
and
drop
and
sorting
from
milestone
view
# visit namespace_project_milestone_path(project.namespace, project, milestone)
# scroll_into_view('.milestone-content')
...
...
spec/models/concerns/milestoneish_spec.rb
View file @
2e3f0b08
...
...
@@ -19,12 +19,47 @@ describe Milestone, 'Milestoneish' do
let!
(
:closed_security_issue_3
)
{
create
(
:issue
,
:confidential
,
:closed
,
project:
project
,
author:
author
,
milestone:
milestone
)
}
let!
(
:closed_security_issue_4
)
{
create
(
:issue
,
:confidential
,
:closed
,
project:
project
,
assignees:
[
assignee
],
milestone:
milestone
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
milestone:
milestone
)
}
let
(
:label_1
)
{
create
(
:label
,
title:
'label_1'
,
project:
project
,
priority:
1
)
}
let
(
:label_2
)
{
create
(
:label
,
title:
'label_2'
,
project:
project
,
priority:
2
)
}
let
(
:label_3
)
{
create
(
:label
,
title:
'label_3'
,
project:
project
)
}
before
do
project
.
team
<<
[
member
,
:developer
]
project
.
team
<<
[
guest
,
:guest
]
end
describe
'#issues_visible_to_user'
do
it
'sorts issues by label priority'
do
issue
.
labels
<<
label_1
security_issue_1
.
labels
<<
label_2
closed_issue_1
.
labels
<<
label_3
issues
=
milestone
.
issues_visible_to_user
(
member
)
expect
(
issues
.
first
).
to
eq
(
issue
)
expect
(
issues
.
second
).
to
eq
(
security_issue_1
)
expect
(
issues
.
third
).
not_to
eq
(
closed_issue_1
)
end
end
describe
'#sorted_merge_requests'
do
let
(
:merge_request_1
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
,
source_branch:
'branch_1'
,
milestone:
milestone
)
}
let
(
:merge_request_2
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
,
source_branch:
'branch_2'
,
milestone:
milestone
)
}
let
(
:merge_request_3
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
,
source_branch:
'branch_3'
,
milestone:
milestone
)
}
it
'sorts merge requests by label priority'
do
merge_request_2
.
labels
<<
label_1
merge_request_1
.
labels
<<
label_2
merge_request_3
.
labels
<<
label_3
merge_requests
=
milestone
.
sorted_merge_requests
expect
(
merge_requests
.
first
).
to
eq
(
merge_request_2
)
expect
(
merge_requests
.
second
).
to
eq
(
merge_request_1
)
expect
(
merge_requests
.
third
).
to
eq
(
merge_request_3
)
end
end
describe
'#closed_items_count'
do
it
'does not count confidential issues for non project members'
do
expect
(
milestone
.
closed_items_count
(
non_member
)).
to
eq
2
...
...
spec/models/group_milestone_spec.rb
View file @
2e3f0b08
...
...
@@ -3,6 +3,7 @@ require 'spec_helper'
describe
GroupMilestone
,
models:
true
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:empty_project
,
group:
group
)
}
let
(
:project_2
)
{
create
(
:empty_project
,
group:
group
)
}
let
(
:project_milestone
)
do
create
(
:milestone
,
title:
"Milestone v1.2"
,
project:
project
)
end
...
...
spec/models/milestone_spec.rb
View file @
2e3f0b08
...
...
@@ -144,35 +144,6 @@ describe Milestone, models: true do
end
end
describe
'#sort_issues'
do
let
(
:milestone
)
{
create
(
:milestone
)
}
let
(
:issue1
)
{
create
(
:issue
,
milestone:
milestone
,
position:
1
)
}
let
(
:issue2
)
{
create
(
:issue
,
milestone:
milestone
,
position:
2
)
}
let
(
:issue3
)
{
create
(
:issue
,
milestone:
milestone
,
position:
3
)
}
let
(
:issue4
)
{
create
(
:issue
,
position:
42
)
}
it
'sorts the given issues'
do
milestone
.
sort_issues
([
issue3
.
id
,
issue2
.
id
,
issue1
.
id
])
issue1
.
reload
issue2
.
reload
issue3
.
reload
expect
(
issue1
.
position
).
to
eq
(
3
)
expect
(
issue2
.
position
).
to
eq
(
2
)
expect
(
issue3
.
position
).
to
eq
(
1
)
end
it
'ignores issues not part of the milestone'
do
milestone
.
sort_issues
([
issue3
.
id
,
issue2
.
id
,
issue1
.
id
,
issue4
.
id
])
issue4
.
reload
expect
(
issue4
.
position
).
to
eq
(
42
)
end
end
describe
'.search'
do
let
(
:milestone
)
{
create
(
:milestone
,
title:
'foo'
,
description:
'bar'
)
}
...
...
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