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
dbfd942b
Commit
dbfd942b
authored
Aug 19, 2020
by
Albert Salim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `let_it_be` for set up
parent
60f6131e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
spec/finders/todos_finder_spec.rb
spec/finders/todos_finder_spec.rb
+11
-16
No files found.
spec/finders/todos_finder_spec.rb
View file @
dbfd942b
...
...
@@ -4,14 +4,14 @@ require 'spec_helper'
RSpec
.
describe
TodosFinder
do
describe
'#execute'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
_it_be
(
:user
)
{
create
(
:user
)
}
let
_it_be
(
:group
)
{
create
(
:group
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
group
)
}
let
_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
_it_be
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:finder
)
{
described_class
}
before
do
before
_all
do
group
.
add_developer
(
user
)
end
...
...
@@ -89,8 +89,6 @@ RSpec.describe TodosFinder do
end
it
'raises an argument error when invalid type is passed'
do
create
(
:todo
,
user:
user
,
group:
group
,
target:
create
(
:design
))
todos_finder
=
finder
.
new
(
user
,
{
type:
%w[Issue MergeRequest NotAValidType]
})
expect
{
todos_finder
.
execute
}.
to
raise_error
(
ArgumentError
)
...
...
@@ -131,8 +129,8 @@ RSpec.describe TodosFinder do
end
context
'when filtering by author'
do
let
(
:author1
)
{
create
(
:user
)
}
let
(
:author2
)
{
create
(
:user
)
}
let
_it_be
(
:author1
)
{
create
(
:user
)
}
let
_it_be
(
:author2
)
{
create
(
:user
)
}
let!
(
:todo1
)
{
create
(
:todo
,
user:
user
,
author:
author1
)
}
let!
(
:todo2
)
{
create
(
:todo
,
user:
user
,
author:
author2
)
}
...
...
@@ -154,7 +152,7 @@ RSpec.describe TodosFinder do
context
'by groups'
do
context
'with subgroups'
do
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let
_it_be
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let!
(
:todo3
)
{
create
(
:todo
,
user:
user
,
group:
subgroup
,
target:
issue
)
}
it
'returns todos from subgroups when filtered by a group'
do
...
...
@@ -167,17 +165,14 @@ RSpec.describe TodosFinder do
context
'filtering for multiple groups'
do
let_it_be
(
:group2
)
{
create
(
:group
)
}
let_it_be
(
:group3
)
{
create
(
:group
)
}
let_it_be
(
:subgroup1
)
{
create
(
:group
,
parent:
group
)
}
let_it_be
(
:subgroup2
)
{
create
(
:group
,
parent:
group2
)
}
let!
(
:todo1
)
{
create
(
:todo
,
user:
user
,
project:
project
,
target:
issue
)
}
let!
(
:todo2
)
{
create
(
:todo
,
user:
user
,
group:
group
,
target:
merge_request
)
}
let!
(
:todo3
)
{
create
(
:todo
,
user:
user
,
group:
group2
,
target:
merge_request
)
}
let
(
:subgroup1
)
{
create
(
:group
,
parent:
group
)
}
let!
(
:todo4
)
{
create
(
:todo
,
user:
user
,
group:
subgroup1
,
target:
issue
)
}
let
(
:subgroup2
)
{
create
(
:group
,
parent:
group2
)
}
let!
(
:todo5
)
{
create
(
:todo
,
user:
user
,
group:
subgroup2
,
target:
issue
)
}
let!
(
:todo6
)
{
create
(
:todo
,
user:
user
,
group:
group3
,
target:
issue
)
}
it
'returns the expected groups'
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