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
c843e092
Commit
c843e092
authored
May 27, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
accdcdf8
b222f211
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
131 additions
and
47 deletions
+131
-47
CHANGELOG
CHANGELOG
+2
-0
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+4
-4
app/finders/README.md
app/finders/README.md
+1
-1
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+83
-21
app/models/ability.rb
app/models/ability.rb
+1
-1
app/views/dashboard/milestones/_milestone.html.haml
app/views/dashboard/milestones/_milestone.html.haml
+2
-2
app/views/dashboard/milestones/show.html.haml
app/views/dashboard/milestones/show.html.haml
+3
-0
app/views/groups/milestones/_milestone.html.haml
app/views/groups/milestones/_milestone.html.haml
+2
-2
app/views/groups/milestones/show.html.haml
app/views/groups/milestones/show.html.haml
+3
-0
app/views/projects/issues/index.html.haml
app/views/projects/issues/index.html.haml
+1
-1
app/views/projects/milestones/_milestone.html.haml
app/views/projects/milestones/_milestone.html.haml
+2
-2
app/views/projects/milestones/show.html.haml
app/views/projects/milestones/show.html.haml
+1
-1
features/project/project.feature
features/project/project.feature
+5
-0
features/steps/groups.rb
features/steps/groups.rb
+2
-2
features/steps/project/project.rb
features/steps/project/project.rb
+4
-0
features/steps/shared/project.rb
features/steps/shared/project.rb
+5
-0
spec/finders/issues_finder_spec.rb
spec/finders/issues_finder_spec.rb
+8
-8
spec/finders/merge_requests_finder_spec.rb
spec/finders/merge_requests_finder_spec.rb
+2
-2
No files found.
CHANGELOG
View file @
c843e092
...
@@ -6,6 +6,8 @@ v 7.12.0 (unreleased)
...
@@ -6,6 +6,8 @@ v 7.12.0 (unreleased)
- Fix Zen Mode not closing with ESC key (Stan Hu)
- Fix Zen Mode not closing with ESC key (Stan Hu)
- Allow HipChat API version to be blank and default to v2 (Stan Hu)
- Allow HipChat API version to be blank and default to v2 (Stan Hu)
- Add file attachment support in Milestone description (Stan Hu)
- Add file attachment support in Milestone description (Stan Hu)
- Fix milestone "Browse Issues" button.
- Set milestone on new issue when creating issue from index with milestone filter active.
- Add web hook support for note events (Stan Hu)
- Add web hook support for note events (Stan Hu)
- Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings (Stan Hu)
- Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings (Stan Hu)
- Remove Rack Attack monkey patches and bump to version 4.3.0 (Stan Hu)
- Remove Rack Attack monkey patches and bump to version 4.3.0 (Stan Hu)
...
...
app/controllers/application_controller.rb
View file @
c843e092
...
@@ -289,14 +289,14 @@ class ApplicationController < ActionController::Base
...
@@ -289,14 +289,14 @@ class ApplicationController < ActionController::Base
def
get_issues_collection
def
get_issues_collection
set_filters_params
set_filters_params
issues
=
IssuesFinder
.
new
.
execute
(
current_user
,
@filter_params
)
@issuable_finder
=
IssuesFinder
.
new
(
current_user
,
@filter_params
)
issues
@issuable_finder
.
execute
end
end
def
get_merge_requests_collection
def
get_merge_requests_collection
set_filters_params
set_filters_params
merge_requests
=
MergeRequestsFinder
.
new
.
execute
(
current_user
,
@filter_params
)
@issuable_finder
=
MergeRequestsFinder
.
new
(
current_user
,
@filter_params
)
merge_requests
@issuable_finder
.
execute
end
end
def
github_import_enabled?
def
github_import_enabled?
...
...
app/finders/README.md
View file @
c843e092
...
@@ -16,7 +16,7 @@ issues = project.issues_for_user_filtered_by(user, params)
...
@@ -16,7 +16,7 @@ issues = project.issues_for_user_filtered_by(user, params)
Better use this:
Better use this:
```
ruby
```
ruby
issues
=
IssuesFinder
.
new
.
execute
(
project
,
user
,
filter
)
issues
=
IssuesFinder
.
new
(
project
,
user
,
filter
).
execute
```
```
It will help keep models thiner.
It will help keep models thiner.
app/finders/issuable_finder.rb
View file @
c843e092
...
@@ -23,10 +23,12 @@ class IssuableFinder
...
@@ -23,10 +23,12 @@ class IssuableFinder
attr_accessor
:current_user
,
:params
attr_accessor
:current_user
,
:params
def
execut
e
(
current_user
,
params
)
def
initializ
e
(
current_user
,
params
)
@current_user
=
current_user
@current_user
=
current_user
@params
=
params
@params
=
params
end
def
execute
items
=
init_collection
items
=
init_collection
items
=
by_scope
(
items
)
items
=
by_scope
(
items
)
items
=
by_state
(
items
)
items
=
by_state
(
items
)
...
@@ -40,6 +42,77 @@ class IssuableFinder
...
@@ -40,6 +42,77 @@ class IssuableFinder
items
=
sort
(
items
)
items
=
sort
(
items
)
end
end
def
group
return
@group
if
defined?
(
@group
)
@group
=
if
params
[
:group_id
].
present?
Group
.
find
(
params
[
:group_id
])
else
nil
end
end
def
project
return
@project
if
defined?
(
@project
)
@project
=
if
params
[
:project_id
].
present?
Project
.
find
(
params
[
:project_id
])
else
nil
end
end
def
search
params
[
:search
].
presence
end
def
milestones?
params
[
:milestone_title
].
present?
end
def
milestones
return
@milestones
if
defined?
(
@milestones
)
@milestones
=
if
milestones?
&&
params
[
:milestone_title
]
!=
NONE
Milestone
.
where
(
title:
params
[
:milestone_title
])
else
nil
end
end
def
assignee?
params
[
:assignee_id
].
present?
end
def
assignee
return
@assignee
if
defined?
(
@assignee
)
@assignee
=
if
assignee?
&&
params
[
:assignee_id
]
!=
NONE
User
.
find
(
params
[
:assignee_id
])
else
nil
end
end
def
author?
params
[
:author_id
].
present?
end
def
author
return
@author
if
defined?
(
@author
)
@author
=
if
author?
&&
params
[
:author_id
]
!=
NONE
User
.
find
(
params
[
:author_id
])
else
nil
end
end
private
private
def
init_collection
def
init_collection
...
@@ -89,25 +162,19 @@ class IssuableFinder
...
@@ -89,25 +162,19 @@ class IssuableFinder
end
end
def
by_group
(
items
)
def
by_group
(
items
)
if
params
[
:group_id
].
present?
items
=
items
.
of_group
(
group
)
if
group
items
=
items
.
of_group
(
Group
.
find
(
params
[
:group_id
]))
end
items
items
end
end
def
by_project
(
items
)
def
by_project
(
items
)
if
params
[
:project_id
].
present?
items
=
items
.
of_projects
(
project
.
id
)
if
project
items
=
items
.
of_projects
(
params
[
:project_id
])
end
items
items
end
end
def
by_search
(
items
)
def
by_search
(
items
)
if
params
[
:search
].
present?
items
=
items
.
search
(
search
)
if
search
items
=
items
.
search
(
params
[
:search
])
end
items
items
end
end
...
@@ -117,25 +184,24 @@ class IssuableFinder
...
@@ -117,25 +184,24 @@ class IssuableFinder
end
end
def
by_milestone
(
items
)
def
by_milestone
(
items
)
if
params
[
:milestone_title
].
present?
if
milestones?
milestone_ids
=
(
params
[
:milestone_title
]
==
NONE
?
nil
:
Milestone
.
where
(
title:
params
[
:milestone_title
]).
pluck
(
:id
))
items
=
items
.
where
(
milestone_id:
milestones
.
try
(
:pluck
,
:id
))
items
=
items
.
where
(
milestone_id:
milestone_ids
)
end
end
items
items
end
end
def
by_assignee
(
items
)
def
by_assignee
(
items
)
if
params
[
:assignee_id
].
present
?
if
assignee
?
items
=
items
.
where
(
assignee_id:
(
params
[
:assignee_id
]
==
NONE
?
nil
:
params
[
:assignee_id
]
))
items
=
items
.
where
(
assignee_id:
assignee
.
try
(
:id
))
end
end
items
items
end
end
def
by_author
(
items
)
def
by_author
(
items
)
if
params
[
:author_id
].
present
?
if
author
?
items
=
items
.
where
(
author_id:
(
params
[
:author_id
]
==
NONE
?
nil
:
params
[
:author_id
]
))
items
=
items
.
where
(
author_id:
author
.
try
(
:id
))
end
end
items
items
...
@@ -155,10 +221,6 @@ class IssuableFinder
...
@@ -155,10 +221,6 @@ class IssuableFinder
items
items
end
end
def
project
Project
.
where
(
id:
params
[
:project_id
]).
first
if
params
[
:project_id
].
present?
end
def
current_user_related?
def
current_user_related?
params
[
:scope
]
==
'created-by-me'
||
params
[
:scope
]
==
'authored'
||
params
[
:scope
]
==
'assigned-to-me'
params
[
:scope
]
==
'created-by-me'
||
params
[
:scope
]
==
'authored'
||
params
[
:scope
]
==
'assigned-to-me'
end
end
...
...
app/models/ability.rb
View file @
c843e092
...
@@ -115,7 +115,7 @@ class Ability
...
@@ -115,7 +115,7 @@ class Ability
end
end
unless
project
.
snippets_enabled
unless
project
.
snippets_enabled
rules
-=
named_abilities
(
'snippet'
)
rules
-=
named_abilities
(
'
project_
snippet'
)
end
end
unless
project
.
wiki_enabled
unless
project
.
wiki_enabled
...
...
app/views/dashboard/milestones/_milestone.html.haml
View file @
c843e092
...
@@ -3,10 +3,10 @@
...
@@ -3,10 +3,10 @@
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
dashboard_milestone_path
(
milestone
.
safe_title
,
title:
milestone
.
title
)
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
dashboard_milestone_path
(
milestone
.
safe_title
,
title:
milestone
.
title
)
.row
.row
.col-sm-6
.col-sm-6
=
link_to
dashboard_milestone_path
(
milestone
.
safe_title
,
title:
milestone
.
title
)
do
=
link_to
issues_dashboard_path
(
milestone_
title:
milestone
.
title
)
do
=
pluralize
milestone
.
issue_count
,
'Issue'
=
pluralize
milestone
.
issue_count
,
'Issue'
=
link_to
dashboard_milestone_path
(
milestone
.
safe_title
,
title:
milestone
.
title
)
do
=
link_to
merge_requests_dashboard_path
(
milestone_
title:
milestone
.
title
)
do
=
pluralize
milestone
.
merge_requests_count
,
'Merge Request'
=
pluralize
milestone
.
merge_requests_count
,
'Merge Request'
%span
.light
#{
milestone
.
percent_complete
}
% complete
%span
.light
#{
milestone
.
percent_complete
}
% complete
...
...
app/views/dashboard/milestones/show.html.haml
View file @
c843e092
...
@@ -56,6 +56,9 @@
...
@@ -56,6 +56,9 @@
Participants
Participants
%span
.badge
=
@dashboard_milestone
.
participants
.
count
%span
.badge
=
@dashboard_milestone
.
participants
.
count
.pull-right
=
link_to
'Browse Issues'
,
issues_dashboard_path
(
milestone_title:
@dashboard_milestone
.
title
),
class:
"btn edit-milestone-link btn-grouped"
.tab-content
.tab-content
.tab-pane.active
#tab-issues
.tab-pane.active
#tab-issues
.row
.row
...
...
app/views/groups/milestones/_milestone.html.haml
View file @
c843e092
...
@@ -9,10 +9,10 @@
...
@@ -9,10 +9,10 @@
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
group_milestone_path
(
@group
,
milestone
.
safe_title
,
title:
milestone
.
title
)
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
group_milestone_path
(
@group
,
milestone
.
safe_title
,
title:
milestone
.
title
)
.row
.row
.col-sm-6
.col-sm-6
=
link_to
group_milestone_path
(
@group
,
milestone
.
safe_title
,
title:
milestone
.
title
)
do
=
link_to
issues_group_path
(
@group
,
milestone_
title:
milestone
.
title
)
do
=
pluralize
milestone
.
issue_count
,
'Issue'
=
pluralize
milestone
.
issue_count
,
'Issue'
=
link_to
group_milestone_path
(
@group
,
milestone
.
safe_title
,
title:
milestone
.
title
)
do
=
link_to
merge_requests_group_path
(
@group
,
milestone_
title:
milestone
.
title
)
do
=
pluralize
milestone
.
merge_requests_count
,
'Merge Request'
=
pluralize
milestone
.
merge_requests_count
,
'Merge Request'
%span
.light
#{
milestone
.
percent_complete
}
% complete
%span
.light
#{
milestone
.
percent_complete
}
% complete
...
...
app/views/groups/milestones/show.html.haml
View file @
c843e092
...
@@ -62,6 +62,9 @@
...
@@ -62,6 +62,9 @@
Participants
Participants
%span
.badge
=
@group_milestone
.
participants
.
count
%span
.badge
=
@group_milestone
.
participants
.
count
.pull-right
=
link_to
'Browse Issues'
,
issues_group_path
(
@group
,
milestone_title:
@group_milestone
.
title
),
class:
"btn edit-milestone-link btn-grouped"
.tab-content
.tab-content
.tab-pane.active
#tab-issues
.tab-pane.active
#tab-issues
.row
.row
...
...
app/views/projects/issues/index.html.haml
View file @
c843e092
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
=
render
'shared/issuable_search_form'
,
path:
namespace_project_issues_path
(
@project
.
namespace
,
@project
)
=
render
'shared/issuable_search_form'
,
path:
namespace_project_issues_path
(
@project
.
namespace
,
@project
)
-
if
can?
current_user
,
:write_issue
,
@project
-
if
can?
current_user
,
:write_issue
,
@project
=
link_to
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
{
assignee_id:
params
[
:assignee_id
],
milestone_id:
params
[
:milestone_id
]
}),
class:
"btn btn-new pull-left"
,
title:
"New Issue"
,
id:
"new_issue_link"
do
=
link_to
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
{
assignee_id:
@issuable_finder
.
assignee
.
try
(
:id
),
milestone_id:
@issuable_finder
.
milestones
.
try
(
:first
).
try
(
:id
)
}),
class:
"btn btn-new pull-left"
,
title:
"New Issue"
,
id:
"new_issue_link"
do
%i
.fa.fa-plus
%i
.fa.fa-plus
New Issue
New Issue
...
...
app/views/projects/milestones/_milestone.html.haml
View file @
c843e092
...
@@ -13,10 +13,10 @@
...
@@ -13,10 +13,10 @@
=
milestone
.
expires_at
=
milestone
.
expires_at
.row
.row
.col-sm-6
.col-sm-6
=
link_to
namespace_project_issues_path
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone_
id:
milestone
.
id
)
do
=
link_to
namespace_project_issues_path
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone_
title:
milestone
.
title
)
do
=
pluralize
milestone
.
issues
.
count
,
'Issue'
=
pluralize
milestone
.
issues
.
count
,
'Issue'
=
link_to
namespace_project_merge_requests_path
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone_
id:
milestone
.
id
)
do
=
link_to
namespace_project_merge_requests_path
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone_
title:
milestone
.
title
)
do
=
pluralize
milestone
.
merge_requests
.
count
,
'Merge Request'
=
pluralize
milestone
.
merge_requests
.
count
,
'Merge Request'
%span
.light
#{
milestone
.
percent_complete
}
% complete
%span
.light
#{
milestone
.
percent_complete
}
% complete
...
...
app/views/projects/milestones/show.html.haml
View file @
c843e092
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
%i
.fa.fa-plus
%i
.fa.fa-plus
New Issue
New Issue
-
if
can?
(
current_user
,
:read_issue
,
@project
)
-
if
can?
(
current_user
,
:read_issue
,
@project
)
=
link_to
'Browse Issues'
,
namespace_project_issues_path
(
@milestone
.
project
.
namespace
,
@milestone
.
project
,
milestone_
id:
@milestone
.
id
),
class:
"btn edit-milestone-link btn-grouped"
=
link_to
'Browse Issues'
,
namespace_project_issues_path
(
@milestone
.
project
.
namespace
,
@milestone
.
project
,
milestone_
title:
@milestone
.
title
),
class:
"btn edit-milestone-link btn-grouped"
.tab-content
.tab-content
.tab-pane.active
#tab-issues
.tab-pane.active
#tab-issues
...
...
features/project/project.feature
View file @
c843e092
...
@@ -68,3 +68,8 @@ Feature: Project
...
@@ -68,3 +68,8 @@ Feature: Project
When
I visit project
"Shop"
page
When
I visit project
"Shop"
page
Then
I should not see
"New Issue"
button
Then
I should not see
"New Issue"
button
And
I should not see
"New Merge Request"
button
And
I should not see
"New Merge Request"
button
Scenario
:
I
should not see Project snippets
Given
I disable snippets in project
When
I visit project
"Shop"
page
Then
I should not see
"Snippets"
button
features/steps/groups.rb
View file @
c843e092
...
@@ -203,8 +203,8 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
...
@@ -203,8 +203,8 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step
'I should see group milestones index page with milestones'
do
step
'I should see group milestones index page with milestones'
do
page
.
should
have_content
(
'Version 7.2'
)
page
.
should
have_content
(
'Version 7.2'
)
page
.
should
have_content
(
'GL-113'
)
page
.
should
have_content
(
'GL-113'
)
page
.
should
have_link
(
'2 Issues'
,
href:
group_milestone_path
(
"owned"
,
"version-7-2"
,
title:
"Version 7.2"
))
page
.
should
have_link
(
'2 Issues'
,
href:
issues_group_path
(
"owned"
,
milestone_
title:
"Version 7.2"
))
page
.
should
have_link
(
'3 Merge Requests'
,
href:
group_milestone_path
(
"owned"
,
"gl-113"
,
title:
"GL-113"
))
page
.
should
have_link
(
'3 Merge Requests'
,
href:
merge_requests_group_path
(
"owned"
,
milestone_
title:
"GL-113"
))
end
end
step
'I click on one group milestone'
do
step
'I click on one group milestone'
do
...
...
features/steps/project/project.rb
View file @
c843e092
...
@@ -110,4 +110,8 @@ class Spinach::Features::Project < Spinach::FeatureSteps
...
@@ -110,4 +110,8 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step
'I should not see "New Merge Request" button'
do
step
'I should not see "New Merge Request" button'
do
page
.
should_not
have_link
'New Merge Request'
page
.
should_not
have_link
'New Merge Request'
end
end
step
'I should not see "Snippets" button'
do
page
.
should_not
have_link
'Snippets'
end
end
end
features/steps/shared/project.rb
View file @
c843e092
...
@@ -14,6 +14,11 @@ module SharedProject
...
@@ -14,6 +14,11 @@ module SharedProject
@project
.
team
<<
[
@user
,
:master
]
@project
.
team
<<
[
@user
,
:master
]
end
end
step
'I disable snippets in project'
do
@project
.
snippets_enabled
=
false
@project
.
save
end
step
'I disable issues and merge requests in project'
do
step
'I disable issues and merge requests in project'
do
@project
.
issues_enabled
=
false
@project
.
issues_enabled
=
false
@project
.
merge_requests_enabled
=
false
@project
.
merge_requests_enabled
=
false
...
...
spec/finders/issues_finder_spec.rb
View file @
c843e092
...
@@ -26,37 +26,37 @@ describe IssuesFinder do
...
@@ -26,37 +26,37 @@ describe IssuesFinder do
context
'scope: all'
do
context
'scope: all'
do
it
'should filter by all'
do
it
'should filter by all'
do
params
=
{
scope:
"all"
,
state:
'opened'
}
params
=
{
scope:
"all"
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
=
IssuesFinder
.
new
(
user
,
params
).
execute
expect
(
issues
.
size
).
to
eq
(
3
)
expect
(
issues
.
size
).
to
eq
(
3
)
end
end
it
'should filter by assignee id'
do
it
'should filter by assignee id'
do
params
=
{
scope:
"all"
,
assignee_id:
user
.
id
,
state:
'opened'
}
params
=
{
scope:
"all"
,
assignee_id:
user
.
id
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
=
IssuesFinder
.
new
(
user
,
params
).
execute
expect
(
issues
.
size
).
to
eq
(
2
)
expect
(
issues
.
size
).
to
eq
(
2
)
end
end
it
'should filter by author id'
do
it
'should filter by author id'
do
params
=
{
scope:
"all"
,
author_id:
user2
.
id
,
state:
'opened'
}
params
=
{
scope:
"all"
,
author_id:
user2
.
id
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
=
IssuesFinder
.
new
(
user
,
params
).
execute
expect
(
issues
).
to
eq
([
issue3
])
expect
(
issues
).
to
eq
([
issue3
])
end
end
it
'should filter by milestone id'
do
it
'should filter by milestone id'
do
params
=
{
scope:
"all"
,
milestone_title:
milestone
.
title
,
state:
'opened'
}
params
=
{
scope:
"all"
,
milestone_title:
milestone
.
title
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
=
IssuesFinder
.
new
(
user
,
params
).
execute
expect
(
issues
).
to
eq
([
issue1
])
expect
(
issues
).
to
eq
([
issue1
])
end
end
it
'should be empty for unauthorized user'
do
it
'should be empty for unauthorized user'
do
params
=
{
scope:
"all"
,
state:
'opened'
}
params
=
{
scope:
"all"
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
nil
,
params
)
issues
=
IssuesFinder
.
new
(
nil
,
params
).
execute
expect
(
issues
.
size
).
to
be_zero
expect
(
issues
.
size
).
to
be_zero
end
end
it
'should not include unauthorized issues'
do
it
'should not include unauthorized issues'
do
params
=
{
scope:
"all"
,
state:
'opened'
}
params
=
{
scope:
"all"
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
user2
,
params
)
issues
=
IssuesFinder
.
new
(
user2
,
params
).
execute
expect
(
issues
.
size
).
to
eq
(
2
)
expect
(
issues
.
size
).
to
eq
(
2
)
expect
(
issues
).
not_to
include
(
issue1
)
expect
(
issues
).
not_to
include
(
issue1
)
expect
(
issues
).
to
include
(
issue2
)
expect
(
issues
).
to
include
(
issue2
)
...
@@ -67,13 +67,13 @@ describe IssuesFinder do
...
@@ -67,13 +67,13 @@ describe IssuesFinder do
context
'personal scope'
do
context
'personal scope'
do
it
'should filter by assignee'
do
it
'should filter by assignee'
do
params
=
{
scope:
"assigned-to-me"
,
state:
'opened'
}
params
=
{
scope:
"assigned-to-me"
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
=
IssuesFinder
.
new
(
user
,
params
).
execute
expect
(
issues
.
size
).
to
eq
(
2
)
expect
(
issues
.
size
).
to
eq
(
2
)
end
end
it
'should filter by project'
do
it
'should filter by project'
do
params
=
{
scope:
"assigned-to-me"
,
state:
'opened'
,
project_id:
project1
.
id
}
params
=
{
scope:
"assigned-to-me"
,
state:
'opened'
,
project_id:
project1
.
id
}
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
=
IssuesFinder
.
new
(
user
,
params
).
execute
expect
(
issues
.
size
).
to
eq
(
1
)
expect
(
issues
.
size
).
to
eq
(
1
)
end
end
end
end
...
...
spec/finders/merge_requests_finder_spec.rb
View file @
c843e092
...
@@ -20,13 +20,13 @@ describe MergeRequestsFinder do
...
@@ -20,13 +20,13 @@ describe MergeRequestsFinder do
describe
"#execute"
do
describe
"#execute"
do
it
'should filter by scope'
do
it
'should filter by scope'
do
params
=
{
scope:
'authored'
,
state:
'opened'
}
params
=
{
scope:
'authored'
,
state:
'opened'
}
merge_requests
=
MergeRequestsFinder
.
new
.
execute
(
user
,
params
)
merge_requests
=
MergeRequestsFinder
.
new
(
user
,
params
).
execute
expect
(
merge_requests
.
size
).
to
eq
(
2
)
expect
(
merge_requests
.
size
).
to
eq
(
2
)
end
end
it
'should filter by project'
do
it
'should filter by project'
do
params
=
{
project_id:
project1
.
id
,
scope:
'authored'
,
state:
'opened'
}
params
=
{
project_id:
project1
.
id
,
scope:
'authored'
,
state:
'opened'
}
merge_requests
=
MergeRequestsFinder
.
new
.
execute
(
user
,
params
)
merge_requests
=
MergeRequestsFinder
.
new
(
user
,
params
).
execute
expect
(
merge_requests
.
size
).
to
eq
(
1
)
expect
(
merge_requests
.
size
).
to
eq
(
1
)
end
end
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