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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
c8a96d8a
Commit
c8a96d8a
authored
Dec 05, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More tests for issues finder
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
e0f30c60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
29 deletions
+52
-29
spec/finders/issues_finder_spec.rb
spec/finders/issues_finder_spec.rb
+52
-29
No files found.
spec/finders/issues_finder_spec.rb
View file @
c8a96d8a
...
@@ -5,9 +5,10 @@ describe IssuesFinder do
...
@@ -5,9 +5,10 @@ describe IssuesFinder do
let
(
:user2
)
{
create
:user
}
let
(
:user2
)
{
create
:user
}
let
(
:project1
)
{
create
(
:project
)
}
let
(
:project1
)
{
create
(
:project
)
}
let
(
:project2
)
{
create
(
:project
)
}
let
(
:project2
)
{
create
(
:project
)
}
let
(
:issue1
)
{
create
(
:issue
,
assignee:
user
,
project:
project1
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project1
)
}
let
(
:issue2
)
{
create
(
:issue
,
assignee:
user
,
project:
project2
)
}
let
(
:issue1
)
{
create
(
:issue
,
author:
user
,
assignee:
user
,
project:
project1
,
milestone:
milestone
)
}
let
(
:issue3
)
{
create
(
:issue
,
assignee:
user2
,
project:
project2
)
}
let
(
:issue2
)
{
create
(
:issue
,
author:
user
,
assignee:
user
,
project:
project2
)
}
let
(
:issue3
)
{
create
(
:issue
,
author:
user2
,
assignee:
user2
,
project:
project2
)
}
before
do
before
do
project1
.
team
<<
[
user
,
:master
]
project1
.
team
<<
[
user
,
:master
]
...
@@ -22,37 +23,59 @@ describe IssuesFinder do
...
@@ -22,37 +23,59 @@ describe IssuesFinder do
issue3
issue3
end
end
it
'should filter by all'
do
context
'scope: all'
do
params
=
{
scope:
"all"
,
state:
'opened'
}
it
'should filter by all'
do
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
params
=
{
scope:
"all"
,
state:
'opened'
}
issues
.
size
.
should
==
3
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
end
issues
.
size
.
should
==
3
end
it
'should filter by assignee
'
do
it
'should filter by assignee id
'
do
params
=
{
scope:
"assigned-to-me"
,
state:
'opened'
}
params
=
{
scope:
"all"
,
assignee_id:
user
.
id
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
.
size
.
should
==
2
issues
.
size
.
should
==
2
end
end
it
'should filter by project
'
do
it
'should filter by author id
'
do
params
=
{
scope:
"assigned-to-me"
,
state:
'opened'
,
project_id:
project1
.
id
}
params
=
{
scope:
"all"
,
author_id:
user2
.
id
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
.
size
.
should
==
1
issues
.
should
==
[
issue3
]
end
end
it
'should be empty for unauthorized user'
do
it
'should filter by milestone id'
do
params
=
{
scope:
"all"
,
state:
'opened'
}
params
=
{
scope:
"all"
,
milestone_id:
milestone
.
id
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
nil
,
params
)
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
.
size
.
should
be_zero
issues
.
should
==
[
issue1
]
end
it
'should be empty for unauthorized user'
do
params
=
{
scope:
"all"
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
nil
,
params
)
issues
.
size
.
should
be_zero
end
it
'should not include unauthorized issues'
do
params
=
{
scope:
"all"
,
state:
'opened'
}
issues
=
IssuesFinder
.
new
.
execute
(
user2
,
params
)
issues
.
size
.
should
==
2
issues
.
should_not
include
(
issue1
)
issues
.
should
include
(
issue2
)
issues
.
should
include
(
issue3
)
end
end
end
it
'should not include unauthorized issues'
do
context
'personal scope'
do
params
=
{
scope:
"all"
,
state:
'opened'
}
it
'should filter by assignee'
do
issues
=
IssuesFinder
.
new
.
execute
(
user2
,
params
)
params
=
{
scope:
"assigned-to-me"
,
state:
'opened'
}
issues
.
size
.
should
==
2
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
.
should_not
include
(
issue1
)
issues
.
size
.
should
==
2
issues
.
should
include
(
issue2
)
end
issues
.
should
include
(
issue3
)
it
'should filter by project'
do
params
=
{
scope:
"assigned-to-me"
,
state:
'opened'
,
project_id:
project1
.
id
}
issues
=
IssuesFinder
.
new
.
execute
(
user
,
params
)
issues
.
size
.
should
==
1
end
end
end
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