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
269d158b
Commit
269d158b
authored
Jan 24, 2022
by
Kev
Committed by
Rémy Coutable
Jan 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix RSpec/TimecopFreeze offenses (Part 1/2)
Changelog: other
parent
2f33a8cb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
.rubocop_todo/rspec/timecop_freeze.yml
.rubocop_todo/rspec/timecop_freeze.yml
+0
-2
ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb
...b/gitlab/analytics/cycle_analytics/data_collector_spec.rb
+9
-7
ee/spec/lib/gitlab/insights/reducers/count_per_period_reducer_spec.rb
...gitlab/insights/reducers/count_per_period_reducer_spec.rb
+2
-2
No files found.
.rubocop_todo/rspec/timecop_freeze.yml
View file @
269d158b
---
RSpec/TimecopFreeze
:
Exclude
:
-
ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb
-
ee/spec/lib/gitlab/insights/reducers/count_per_period_reducer_spec.rb
-
ee/spec/models/merge_train_spec.rb
-
ee/spec/support/shared_contexts/lib/gitlab/insights/reducers/reducers_shared_contexts.rb
-
qa/spec/support/repeater_spec.rb
...
...
ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb
View file @
269d158b
...
...
@@ -12,7 +12,9 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::DataCollector do
end
around
do
|
example
|
Timecop
.
freeze
(
current_time
)
{
example
.
run
}
travel_to
(
current_time
)
example
.
run
travel_back
end
def
round_to_days
(
seconds
)
...
...
@@ -596,13 +598,13 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::DataCollector do
before
do
group
.
add_user
(
user
,
GroupMember
::
MAINTAINER
)
travel_to
(
Time
.
new
(
2019
,
6
,
1
))
do
travel_to
(
Time
.
new
(
2019
,
6
,
1
))
mr
=
create
(
:merge_request
,
source_project:
project1
)
mr
.
metrics
.
update!
(
merged_at:
1
.
hour
.
from_now
)
mr
=
create
(
:merge_request
,
source_project:
project2
)
mr
.
metrics
.
update!
(
merged_at:
1
.
hour
.
from_now
)
end
travel_back
end
shared_examples
'filter examples'
do
...
...
ee/spec/lib/gitlab/insights/reducers/count_per_period_reducer_spec.rb
View file @
269d158b
...
...
@@ -26,7 +26,7 @@ RSpec.describe Gitlab::Insights::Reducers::CountPerPeriodReducer do
context
'with no issues'
do
around
do
|
example
|
Timecop
.
freeze
(
Time
.
utc
(
2019
,
5
,
5
))
{
example
.
run
}
travel_to
(
Time
.
utc
(
2019
,
5
,
5
))
{
example
.
run
}
end
let
(
:project
)
{
create
(
:project
,
:public
)
}
...
...
@@ -144,7 +144,7 @@ RSpec.describe Gitlab::Insights::Reducers::CountPerPeriodReducer do
merge_request
=
public_send
(
"issuable
#{
i
}
"
)
merge_request_metrics_service
=
MergeRequestMetricsService
.
new
(
merge_request
.
metrics
)
Event
.
transaction
do
Timecop
.
freeze
(
merge_request
.
created_at
)
do
travel_to
(
merge_request
.
created_at
)
do
merge_event
=
EventCreateService
.
new
.
merge_mr
(
merge_request
,
merge_request
.
author
)
merge_request_metrics_service
.
merge
(
merge_event
)
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