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
3af34497
Commit
3af34497
authored
Jan 11, 2021
by
Luke Duncalfe
Committed by
Jan Provaznik
Jan 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TimeFrameFilter return logic
parent
a7b9628b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
app/finders/concerns/time_frame_filter.rb
app/finders/concerns/time_frame_filter.rb
+1
-1
ee/spec/finders/epics_finder_spec.rb
ee/spec/finders/epics_finder_spec.rb
+14
-0
ee/spec/finders/iterations_finder_spec.rb
ee/spec/finders/iterations_finder_spec.rb
+14
-0
No files found.
app/finders/concerns/time_frame_filter.rb
View file @
3af34497
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
module
TimeFrameFilter
module
TimeFrameFilter
def
by_timeframe
(
items
)
def
by_timeframe
(
items
)
return
items
unless
params
[
:start_date
]
&&
params
[
:
start
_date
]
return
items
unless
params
[
:start_date
]
&&
params
[
:
end
_date
]
start_date
=
params
[
:start_date
].
to_date
start_date
=
params
[
:start_date
].
to_date
end_date
=
params
[
:end_date
].
to_date
end_date
=
params
[
:end_date
].
to_date
...
...
ee/spec/finders/epics_finder_spec.rb
View file @
3af34497
...
@@ -211,6 +211,20 @@ RSpec.describe EpicsFinder do
...
@@ -211,6 +211,20 @@ RSpec.describe EpicsFinder do
expect
(
epics
(
params
)).
to
contain_exactly
(
epic3
)
expect
(
epics
(
params
)).
to
contain_exactly
(
epic3
)
end
end
describe
'when one of the timeframe params are missing'
do
it
'does not filter by timeframe if start_date is missing'
do
only_end_date
=
epics
(
end_date:
1
.
year
.
ago
.
strftime
(
'%Y-%m-%d'
))
expect
(
only_end_date
).
to
eq
(
epics
)
end
it
'does not filter by timeframe if end_date is missing'
do
only_start_date
=
epics
(
start_date:
1
.
year
.
from_now
.
strftime
(
'%Y-%m-%d'
))
expect
(
only_start_date
).
to
eq
(
epics
)
end
end
end
end
context
'by parent'
do
context
'by parent'
do
...
...
ee/spec/finders/iterations_finder_spec.rb
View file @
3af34497
...
@@ -140,6 +140,20 @@ RSpec.describe IterationsFinder do
...
@@ -140,6 +140,20 @@ RSpec.describe IterationsFinder do
expect
(
subject
).
to
match_array
([
iteration
])
expect
(
subject
).
to
match_array
([
iteration
])
end
end
describe
'when one of the timeframe params are missing'
do
it
'does not filter by timeframe if start_date is missing'
do
only_end_date
=
described_class
.
new
(
user
,
params
.
merge
(
end_date:
1
.
year
.
ago
)).
execute
expect
(
only_end_date
).
to
eq
(
subject
)
end
it
'does not filter by timeframe if end_date is missing'
do
only_start_date
=
described_class
.
new
(
user
,
params
.
merge
(
start_date:
1
.
year
.
from_now
)).
execute
expect
(
only_start_date
).
to
eq
(
subject
)
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