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
0317af90
Commit
0317af90
authored
Oct 28, 2020
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some usages of Timecop.freeze
To comply with RSpec/TimecopFreeze cop
parent
ac137926
Changes
48
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
75 additions
and
122 deletions
+75
-122
.rubocop_todo.yml
.rubocop_todo.yml
+2
-49
ee/spec/controllers/admin/application_settings_controller_spec.rb
...controllers/admin/application_settings_controller_spec.rb
+1
-1
ee/spec/controllers/projects/security/network_policies_controller_spec.rb
...ers/projects/security/network_policies_controller_spec.rb
+2
-2
ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb
ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb
+1
-1
ee/spec/features/boards/sidebar_spec.rb
ee/spec/features/boards/sidebar_spec.rb
+1
-1
ee/spec/features/groups/analytics/cycle_analytics/filters_and_data_spec.rb
...groups/analytics/cycle_analytics/filters_and_data_spec.rb
+1
-1
ee/spec/features/groups/iteration_spec.rb
ee/spec/features/groups/iteration_spec.rb
+1
-1
ee/spec/features/projects/mirror_spec.rb
ee/spec/features/projects/mirror_spec.rb
+2
-2
ee/spec/features/projects/services/prometheus_custom_metrics_spec.rb
...tures/projects/services/prometheus_custom_metrics_spec.rb
+1
-1
ee/spec/finders/productivity_analytics_finder_spec.rb
ee/spec/finders/productivity_analytics_finder_spec.rb
+2
-2
ee/spec/helpers/vulnerabilities_helper_spec.rb
ee/spec/helpers/vulnerabilities_helper_spec.rb
+1
-1
ee/spec/lib/analytics/merge_request_metrics_refresh_spec.rb
ee/spec/lib/analytics/merge_request_metrics_refresh_spec.rb
+1
-1
ee/spec/lib/analytics/productivity_analytics_request_params_spec.rb
...b/analytics/productivity_analytics_request_params_spec.rb
+1
-1
ee/spec/lib/ee/gitlab/background_migration/populate_vulnerability_historical_statistics_spec.rb
...tion/populate_vulnerability_historical_statistics_spec.rb
+1
-1
ee/spec/lib/gitlab/analytics/cycle_analytics/group_stage_time_summary_spec.rb
...nalytics/cycle_analytics/group_stage_time_summary_spec.rb
+1
-1
ee/spec/lib/gitlab/analytics/cycle_analytics/summary/group/stage_time_summary_spec.rb
.../cycle_analytics/summary/group/stage_time_summary_spec.rb
+1
-1
ee/spec/lib/gitlab/analytics/type_of_work/tasks_by_type_spec.rb
...c/lib/gitlab/analytics/type_of_work/tasks_by_type_spec.rb
+1
-1
ee/spec/lib/gitlab/auth/group_saml/sso_enforcer_spec.rb
ee/spec/lib/gitlab/auth/group_saml/sso_enforcer_spec.rb
+2
-2
ee/spec/lib/gitlab/database/load_balancing/host_spec.rb
ee/spec/lib/gitlab/database/load_balancing/host_spec.rb
+1
-1
ee/spec/lib/gitlab/geo/base_request_spec.rb
ee/spec/lib/gitlab/geo/base_request_spec.rb
+1
-1
ee/spec/lib/gitlab/geo/event_gap_tracking_spec.rb
ee/spec/lib/gitlab/geo/event_gap_tracking_spec.rb
+4
-4
ee/spec/lib/gitlab/geo/log_cursor/events/repository_updated_event_spec.rb
...ab/geo/log_cursor/events/repository_updated_event_spec.rb
+2
-2
ee/spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb
...heus/queries/additional_metrics_environment_query_spec.rb
+1
-1
ee/spec/lib/gitlab/prometheus/queries/cluster_query_spec.rb
ee/spec/lib/gitlab/prometheus/queries/cluster_query_spec.rb
+1
-1
ee/spec/migrations/20190926180443_schedule_epic_issues_after_epics_move_spec.rb
...90926180443_schedule_epic_issues_after_epics_move_spec.rb
+1
-1
ee/spec/migrations/populate_vulnerability_historical_statistics_for_year_spec.rb
...late_vulnerability_historical_statistics_for_year_spec.rb
+2
-2
ee/spec/migrations/remove_duplicated_cs_findings_spec.rb
ee/spec/migrations/remove_duplicated_cs_findings_spec.rb
+1
-1
ee/spec/migrations/remove_duplicated_cs_findings_without_vulnerability_id_spec.rb
...e_duplicated_cs_findings_without_vulnerability_id_spec.rb
+1
-1
ee/spec/migrations/schedule_fix_orphan_promoted_issues_spec.rb
...ec/migrations/schedule_fix_orphan_promoted_issues_spec.rb
+1
-1
ee/spec/migrations/schedule_merge_request_any_approval_rule_migration_spec.rb
...chedule_merge_request_any_approval_rule_migration_spec.rb
+2
-2
ee/spec/migrations/schedule_populate_resolved_on_default_branch_column_spec.rb
...hedule_populate_resolved_on_default_branch_column_spec.rb
+1
-1
ee/spec/migrations/schedule_populate_vulnerability_historical_statistics_spec.rb
...dule_populate_vulnerability_historical_statistics_spec.rb
+2
-2
ee/spec/migrations/schedule_project_any_approval_rule_migration_spec.rb
...ions/schedule_project_any_approval_rule_migration_spec.rb
+2
-2
ee/spec/migrations/set_resolved_state_on_vulnerabilities_spec.rb
.../migrations/set_resolved_state_on_vulnerabilities_spec.rb
+1
-1
ee/spec/models/analytics/cycle_analytics/group_level_spec.rb
ee/spec/models/analytics/cycle_analytics/group_level_spec.rb
+1
-1
ee/spec/models/burndown_spec.rb
ee/spec/models/burndown_spec.rb
+1
-1
ee/spec/models/ee/namespace_spec.rb
ee/spec/models/ee/namespace_spec.rb
+1
-1
ee/spec/models/geo/project_registry_spec.rb
ee/spec/models/geo/project_registry_spec.rb
+3
-3
ee/spec/models/productivity_analytics_spec.rb
ee/spec/models/productivity_analytics_spec.rb
+1
-1
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+3
-3
ee/spec/models/vulnerabilities/export_spec.rb
ee/spec/models/vulnerabilities/export_spec.rb
+1
-1
ee/spec/requests/api/vulnerabilities_spec.rb
ee/spec/requests/api/vulnerabilities_spec.rb
+4
-4
ee/spec/services/geo/file_download_service_spec.rb
ee/spec/services/geo/file_download_service_spec.rb
+6
-6
ee/spec/services/vulnerabilities/confirm_service_spec.rb
ee/spec/services/vulnerabilities/confirm_service_spec.rb
+1
-1
ee/spec/services/vulnerabilities/dismiss_service_spec.rb
ee/spec/services/vulnerabilities/dismiss_service_spec.rb
+3
-3
ee/spec/services/vulnerabilities/resolve_service_spec.rb
ee/spec/services/vulnerabilities/resolve_service_spec.rb
+1
-1
ee/spec/services/vulnerabilities/revert_to_detected_service_spec.rb
...rvices/vulnerabilities/revert_to_detected_service_spec.rb
+1
-1
ee/spec/services/vulnerability_exports/export_service_spec.rb
...pec/services/vulnerability_exports/export_service_spec.rb
+1
-1
No files found.
.rubocop_todo.yml
View file @
0317af90
...
...
@@ -1119,60 +1119,13 @@ Rails/SaveBang:
# Cop supports --auto-correct.
RSpec/TimecopFreeze
:
Exclude
:
-
'
ee/spec/controllers/admin/application_settings_controller_spec.rb'
-
'
ee/spec/controllers/projects/security/network_policies_controller_spec.rb'
-
'
ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb'
-
'
ee/spec/features/boards/sidebar_spec.rb'
-
'
ee/spec/features/groups/analytics/cycle_analytics/filters_and_data_spec.rb'
-
'
ee/spec/features/groups/iteration_spec.rb'
-
'
ee/spec/features/projects/mirror_spec.rb'
-
'
ee/spec/features/projects/services/prometheus_custom_metrics_spec.rb'
-
'
ee/spec/finders/productivity_analytics_finder_spec.rb'
-
'
ee/spec/frontend/fixtures/analytics.rb'
-
'
ee/spec/helpers/vulnerabilities_helper_spec.rb'
-
'
ee/spec/lib/analytics/merge_request_metrics_refresh_spec.rb'
-
'
ee/spec/lib/analytics/productivity_analytics_request_params_spec.rb'
-
'
ee/spec/lib/ee/gitlab/background_migration/populate_vulnerability_historical_statistics_spec.rb'
-
'
ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb'
-
'
ee/spec/lib/gitlab/analytics/cycle_analytics/group_stage_time_summary_spec.rb'
-
'
ee/spec/lib/gitlab/analytics/cycle_analytics/summary/group/stage_time_summary_spec.rb'
-
'
ee/spec/lib/gitlab/analytics/type_of_work/tasks_by_type_spec.rb'
-
'
ee/spec/lib/gitlab/auth/group_saml/sso_enforcer_spec.rb'
-
'
ee/spec/lib/gitlab/database/load_balancing/host_spec.rb'
-
'
ee/spec/lib/gitlab/geo/base_request_spec.rb'
-
'
ee/spec/lib/gitlab/geo/event_gap_tracking_spec.rb'
-
'
ee/spec/lib/gitlab/geo/git_push_http_spec.rb'
-
'
ee/spec/lib/gitlab/geo/log_cursor/daemon_spec.rb'
-
'
ee/spec/lib/gitlab/
geo/log_cursor/events/repository_updated_event
_spec.rb'
-
'
ee/spec/lib/gitlab/
analytics/cycle_analytics/data_collector
_spec.rb'
-
'
ee/spec/lib/gitlab/geo/oauth/login_state_spec.rb'
-
'
ee/spec/lib/gitlab/insights/reducers/count_per_period_reducer_spec.rb'
-
'
ee/spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb'
-
'
ee/spec/lib/gitlab/prometheus/queries/cluster_query_spec.rb'
-
'
ee/spec/migrations/populate_vulnerability_historical_statistics_for_year_spec.rb'
-
'
ee/spec/migrations/remove_duplicated_cs_findings_spec.rb'
-
'
ee/spec/migrations/remove_duplicated_cs_findings_without_vulnerability_id_spec.rb'
-
'
ee/spec/migrations/schedule_fix_orphan_promoted_issues_spec.rb'
-
'
ee/spec/migrations/schedule_merge_request_any_approval_rule_migration_spec.rb'
-
'
ee/spec/migrations/schedule_populate_resolved_on_default_branch_column_spec.rb'
-
'
ee/spec/migrations/schedule_populate_vulnerability_historical_statistics_spec.rb'
-
'
ee/spec/migrations/schedule_project_any_approval_rule_migration_spec.rb'
-
'
ee/spec/migrations/set_resolved_state_on_vulnerabilities_spec.rb'
-
'
ee/spec/migrations/20190926180443_schedule_epic_issues_after_epics_move_spec.rb'
-
'
ee/spec/models/analytics/cycle_analytics/group_level_spec.rb'
-
'
ee/spec/models/burndown_spec.rb'
-
'
ee/spec/models/ee/namespace_spec.rb'
-
'
ee/spec/models/geo/project_registry_spec.rb'
-
'
ee/spec/models/merge_train_spec.rb'
-
'
ee/spec/models/productivity_analytics_spec.rb'
-
'
ee/spec/models/project_spec.rb'
-
'
ee/spec/models/vulnerabilities/export_spec.rb'
-
'
ee/spec/requests/api/vulnerabilities_spec.rb'
-
'
ee/spec/services/geo/file_download_service_spec.rb'
-
'
ee/spec/services/vulnerabilities/confirm_service_spec.rb'
-
'
ee/spec/services/vulnerabilities/dismiss_service_spec.rb'
-
'
ee/spec/services/vulnerabilities/resolve_service_spec.rb'
-
'
ee/spec/services/vulnerabilities/revert_to_detected_service_spec.rb'
-
'
ee/spec/services/vulnerability_exports/export_service_spec.rb'
-
'
ee/spec/frontend/fixtures/analytics.rb'
-
'
ee/spec/support/shared_contexts/lib/gitlab/insights/reducers/reducers_shared_contexts.rb'
-
'
qa/spec/support/repeater_spec.rb'
-
'
spec/features/profiles/active_sessions_spec.rb'
...
...
ee/spec/controllers/admin/application_settings_controller_spec.rb
View file @
0317af90
...
...
@@ -298,7 +298,7 @@ RSpec.describe Admin::ApplicationSettingsController do
let_it_be
(
:current_count
)
{
10
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
before_all
do
...
...
ee/spec/controllers/projects/security/network_policies_controller_spec.rb
View file @
0317af90
...
...
@@ -73,7 +73,7 @@ RSpec.describe Projects::Security::NetworkPoliciesController do
end
it
'returns network policies summary'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
adapter
).
to
(
receive
(
:query
)
.
with
(
:packet_flow
,
kubernetes_namespace
,
"minute"
,
1
.
hour
.
ago
.
to_s
,
Time
.
current
.
to_s
)
...
...
@@ -114,7 +114,7 @@ RSpec.describe Projects::Security::NetworkPoliciesController do
end
it
'queries with default arguments'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
adapter
).
to
(
receive
(
:query
)
.
with
(
:packet_flow
,
kubernetes_namespace
,
"minute"
,
1
.
hour
.
ago
.
to_s
,
Time
.
current
.
to_s
)
...
...
ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb
View file @
0317af90
...
...
@@ -18,7 +18,7 @@ RSpec.describe 'Reset namespace pipeline minutes', :js do
it
'resets pipeline minutes'
do
time
=
Time
.
now
Timecop
.
freeze
(
time
)
do
travel_to
(
time
)
do
click_button
'Reset pipeline minutes'
end
...
...
ee/spec/features/boards/sidebar_spec.rb
View file @
0317af90
...
...
@@ -22,7 +22,7 @@ RSpec.describe 'Issue Boards', :js do
let
(
:card2
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(1)'
)
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
before
do
...
...
ee/spec/features/groups/analytics/cycle_analytics/filters_and_data_spec.rb
View file @
0317af90
...
...
@@ -284,7 +284,7 @@ RSpec.describe 'Group value stream analytics filters and data', :js do
let_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
,
created_at:
5
.
days
.
ago
)
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
before
do
...
...
ee/spec/features/groups/iteration_spec.rb
View file @
0317af90
...
...
@@ -13,7 +13,7 @@ RSpec.describe 'Group iterations' do
let_it_be
(
:user
)
{
create
(
:group_member
,
:maintainer
,
user:
create
(
:user
),
group:
group
).
user
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
before
do
...
...
ee/spec/features/projects/mirror_spec.rb
View file @
0317af90
...
...
@@ -52,7 +52,7 @@ RSpec.describe 'Project mirror', :js do
context
'when able to force update'
do
it
'forces import'
do
Timecop
.
freeze
(
timestamp
)
do
travel_to
(
timestamp
)
do
visit
project_mirror_path
(
project
)
end
...
...
@@ -72,7 +72,7 @@ RSpec.describe 'Project mirror', :js do
let
(
:disabled_updating_button
)
{
'[data-qa-selector="updating_button"].disabled'
}
it
'disables Update now button'
do
Timecop
.
freeze
(
timestamp
)
do
travel_to
(
timestamp
)
do
visit
project_mirror_path
(
project
)
end
...
...
ee/spec/features/projects/services/prometheus_custom_metrics_spec.rb
View file @
0317af90
...
...
@@ -10,7 +10,7 @@ RSpec.describe 'Prometheus custom metrics', :js do
let!
(
:prometheus_metric
)
{
create
(
:prometheus_metric
,
project:
project
)
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
before
do
...
...
ee/spec/finders/productivity_analytics_finder_spec.rb
View file @
0317af90
...
...
@@ -35,7 +35,7 @@ RSpec.describe ProductivityAnalyticsFinder do
let
(
:search_params
)
{
{
days_to_merge:
[
30
]
}
}
it
'returns all MRs with merged_at - created_at IN specified values'
do
Timecop
.
freez
e
do
freeze_tim
e
do
long_mr
short_mr
expect
(
subject
.
execute
).
to
match_array
([
long_mr
])
...
...
@@ -51,7 +51,7 @@ RSpec.describe ProductivityAnalyticsFinder do
end
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
context
'with merged_after specified as timestamp'
do
...
...
ee/spec/helpers/vulnerabilities_helper_spec.rb
View file @
0317af90
...
...
@@ -52,7 +52,7 @@ RSpec.describe VulnerabilitiesHelper do
end
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
it
'has expected vulnerability properties'
do
...
...
ee/spec/lib/analytics/merge_request_metrics_refresh_spec.rb
View file @
0317af90
...
...
@@ -6,7 +6,7 @@ RSpec.describe Analytics::MergeRequestMetricsRefresh do
subject
{
calculator_class
.
new
(
merge_request
)
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
let
(
:calculator_class
)
do
...
...
ee/spec/lib/analytics/productivity_analytics_request_params_spec.rb
View file @
0317af90
...
...
@@ -68,7 +68,7 @@ RSpec.describe Analytics::ProductivityAnalyticsRequestParams do
describe
'default values'
do
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
describe
'`merged_before`'
do
...
...
ee/spec/lib/ee/gitlab/background_migration/populate_vulnerability_historical_statistics_spec.rb
View file @
0317af90
...
...
@@ -31,7 +31,7 @@ RSpec.describe Gitlab::BackgroundMigration::PopulateVulnerabilityHistoricalStati
end
around
do
|
example
|
Timecop
.
freeze
(
Date
.
parse
(
'2020-07-28'
))
{
example
.
run
}
travel_to
(
Date
.
parse
(
'2020-07-28'
))
{
example
.
run
}
end
before
do
...
...
ee/spec/lib/gitlab/analytics/cycle_analytics/group_stage_time_summary_spec.rb
View file @
0317af90
...
...
@@ -13,7 +13,7 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::GroupStageTimeSummary do
subject
{
described_class
.
new
(
group
,
options:
options
).
data
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
describe
'#lead_time'
do
...
...
ee/spec/lib/gitlab/analytics/cycle_analytics/summary/group/stage_time_summary_spec.rb
View file @
0317af90
...
...
@@ -12,7 +12,7 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::Summary::Group::StageTimeSumma
subject
{
described_class
.
new
(
group
,
options:
{
from:
from
,
to:
to
,
current_user:
user
}).
data
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
describe
'#lead_time'
do
...
...
ee/spec/lib/gitlab/analytics/type_of_work/tasks_by_type_spec.rb
View file @
0317af90
...
...
@@ -27,7 +27,7 @@ RSpec.describe Gitlab::Analytics::TypeOfWork::TasksByType do
end
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
before
do
...
...
ee/spec/lib/gitlab/auth/group_saml/sso_enforcer_spec.rb
View file @
0317af90
...
...
@@ -24,7 +24,7 @@ RSpec.describe Gitlab::Auth::GroupSaml::SsoEnforcer do
end
it
'stores the current time for later comparison'
do
Timecop
.
freez
e
do
freeze_tim
e
do
subject
.
update_session
expect
(
session
[
:active_group_sso_sign_ins
][
saml_provider
.
id
]).
to
eq
DateTime
.
now
...
...
@@ -58,7 +58,7 @@ RSpec.describe Gitlab::Auth::GroupSaml::SsoEnforcer do
subject
.
update_session
days_after_timeout
=
Gitlab
::
Auth
::
GroupSaml
::
SsoEnforcer
::
DEFAULT_SESSION_TIMEOUT
+
2
.
days
Timecop
.
freeze
(
days_after_timeout
)
do
travel_to
(
days_after_timeout
.
from_now
)
do
expect
(
subject
).
not_to
be_active_session
end
end
...
...
ee/spec/lib/gitlab/database/load_balancing/host_spec.rb
View file @
0317af90
...
...
@@ -195,7 +195,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Host do
end
it
'returns false when we do not need to check the replica status'
do
Timecop
.
freez
e
do
freeze_tim
e
do
allow
(
host
)
.
to
receive
(
:last_checked_at
)
.
and_return
(
Time
.
zone
.
now
)
...
...
ee/spec/lib/gitlab/geo/base_request_spec.rb
View file @
0317af90
...
...
@@ -25,7 +25,7 @@ RSpec.describe Gitlab::Geo::BaseRequest, :geo do
end
it
'defaults to 1-minute expiration time'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
jwt
.
first
[
'exp'
]).
to
eq
((
Time
.
now
+
1
.
minute
).
to_i
)
end
end
...
...
ee/spec/lib/gitlab/geo/event_gap_tracking_spec.rb
View file @
0317af90
...
...
@@ -79,7 +79,7 @@ RSpec.describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do
describe
'#fill_gaps'
do
it
'ignore gaps that are less than 10 minutes old'
do
Timecop
.
freez
e
do
freeze_tim
e
do
gap_tracking
.
check!
(
event_id_with_gap
)
expect
{
|
blk
|
gap_tracking
.
fill_gaps
(
&
blk
)
}.
not_to
yield_with_args
(
anything
)
...
...
@@ -145,7 +145,7 @@ RSpec.describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do
end
it
'saves the gap id in redis'
do
Timecop
.
freez
e
do
freeze_tim
e
do
gap_tracking
.
send
(
:track_gaps
,
event_id_with_gap
)
expect
(
read_gaps
).
to
contain_exactly
([
gap_id
.
to_s
,
Time
.
now
.
to_i
])
...
...
@@ -153,7 +153,7 @@ RSpec.describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do
end
it
'saves a range of gaps id in redis'
do
Timecop
.
freez
e
do
freeze_tim
e
do
gap_tracking
.
send
(
:track_gaps
,
event_id_with_gap
+
3
)
expected_gaps
=
((
previous_event_id
+
1
)
..
(
event_id_with_gap
+
2
)).
collect
{
|
id
|
[
id
.
to_s
,
Time
.
now
.
to_i
]
}
...
...
@@ -165,7 +165,7 @@ RSpec.describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do
it
'saves the gaps in order'
do
expected_gaps
=
[]
Timecop
.
freez
e
do
freeze_tim
e
do
gap_tracking
.
send
(
:track_gaps
,
event_id_with_gap
)
expected_gaps
<<
[
gap_id
.
to_s
,
Time
.
now
.
to_i
]
end
...
...
ee/spec/lib/gitlab/geo/log_cursor/events/repository_updated_event_spec.rb
View file @
0317af90
...
...
@@ -68,7 +68,7 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::RepositoryUpdatedEvent, :clean_gi
end
it
'sets resync_repository_was_scheduled_at to the scheduled time'
do
Timecop
.
freez
e
do
freeze_tim
e
do
subject
.
process
reloaded_registry
=
registry
.
reload
...
...
@@ -100,7 +100,7 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::RepositoryUpdatedEvent, :clean_gi
end
it
'sets resync_wiki_was_scheduled_at to the scheduled time'
do
Timecop
.
freez
e
do
freeze_tim
e
do
subject
.
process
reloaded_registry
=
registry
.
reload
...
...
ee/spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb
View file @
0317af90
...
...
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec
.
describe
Gitlab
::
Prometheus
::
Queries
::
AdditionalMetricsEnvironmentQuery
do
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
include_examples
'additional custom metrics query'
do
...
...
ee/spec/lib/gitlab/prometheus/queries/cluster_query_spec.rb
View file @
0317af90
...
...
@@ -8,7 +8,7 @@ RSpec.describe Gitlab::Prometheus::Queries::ClusterQuery do
subject
{
described_class
.
new
(
client
)
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
it
'load cluster metrics from yaml'
do
...
...
ee/spec/migrations/20190926180443_schedule_epic_issues_after_epics_move_spec.rb
View file @
0317af90
...
...
@@ -44,7 +44,7 @@ RSpec.describe ScheduleEpicIssuesAfterEpicsMove do
it
'schedules background migrations at correct time'
,
:aggregate_failures
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
described_class
::
MIGRATION
).
to
(
...
...
ee/spec/migrations/populate_vulnerability_historical_statistics_for_year_spec.rb
View file @
0317af90
...
...
@@ -33,7 +33,7 @@ RSpec.describe PopulateVulnerabilityHistoricalStatisticsForYear do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
1
)
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
described_class
::
MIGRATION
)
...
...
@@ -56,7 +56,7 @@ RSpec.describe PopulateVulnerabilityHistoricalStatisticsForYear do
create_project
(
2
)
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
0
)
...
...
ee/spec/migrations/remove_duplicated_cs_findings_spec.rb
View file @
0317af90
...
...
@@ -24,7 +24,7 @@ RSpec.describe RemoveDuplicatedCsFindings, :migration do
end
around
do
|
example
|
Timecop
.
freez
e
{
Sidekiq
::
Testing
.
fake!
{
example
.
run
}
}
freeze_tim
e
{
Sidekiq
::
Testing
.
fake!
{
example
.
run
}
}
end
it
'updates location fingerprint for containter scanning findings'
,
:sidekiq_might_not_need_inline
do
...
...
ee/spec/migrations/remove_duplicated_cs_findings_without_vulnerability_id_spec.rb
View file @
0317af90
...
...
@@ -26,7 +26,7 @@ RSpec.describe RemoveDuplicatedCsFindingsWithoutVulnerabilityId, :migration do
end
around
do
|
example
|
Timecop
.
freez
e
{
Sidekiq
::
Testing
.
fake!
{
example
.
run
}
}
freeze_tim
e
{
Sidekiq
::
Testing
.
fake!
{
example
.
run
}
}
end
it
'removes duplicate findings and vulnerabilities'
do
...
...
ee/spec/migrations/schedule_fix_orphan_promoted_issues_spec.rb
View file @
0317af90
...
...
@@ -15,7 +15,7 @@ RSpec.describe ScheduleFixOrphanPromotedIssues do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
described_class
::
BACKGROUND_MIGRATION
).
to
be_scheduled_migration
(
promote_orphan_1_note
.
id
)
...
...
ee/spec/migrations/schedule_merge_request_any_approval_rule_migration_spec.rb
View file @
0317af90
...
...
@@ -35,7 +35,7 @@ RSpec.describe ScheduleMergeRequestAnyApprovalRuleMigration do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
described_class
::
MIGRATION
)
...
...
@@ -58,7 +58,7 @@ RSpec.describe ScheduleMergeRequestAnyApprovalRuleMigration do
create_merge_request
(
2
)
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
0
)
...
...
ee/spec/migrations/schedule_populate_resolved_on_default_branch_column_spec.rb
View file @
0317af90
...
...
@@ -9,7 +9,7 @@ RSpec.describe SchedulePopulateResolvedOnDefaultBranchColumn do
end
around
do
|
example
|
Timecop
.
freez
e
{
Sidekiq
::
Testing
.
fake!
{
example
.
run
}
}
freeze_tim
e
{
Sidekiq
::
Testing
.
fake!
{
example
.
run
}
}
end
context
'when the Gitlab instance is CE'
do
...
...
ee/spec/migrations/schedule_populate_vulnerability_historical_statistics_spec.rb
View file @
0317af90
...
...
@@ -33,7 +33,7 @@ RSpec.describe SchedulePopulateVulnerabilityHistoricalStatistics do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
1
)
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
described_class
::
MIGRATION
)
...
...
@@ -56,7 +56,7 @@ RSpec.describe SchedulePopulateVulnerabilityHistoricalStatistics do
create_project
(
2
)
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
0
)
...
...
ee/spec/migrations/schedule_project_any_approval_rule_migration_spec.rb
View file @
0317af90
...
...
@@ -30,7 +30,7 @@ RSpec.describe ScheduleProjectAnyApprovalRuleMigration do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
described_class
::
MIGRATION
)
...
...
@@ -53,7 +53,7 @@ RSpec.describe ScheduleProjectAnyApprovalRuleMigration do
create_project
(
2
)
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
0
)
...
...
ee/spec/migrations/set_resolved_state_on_vulnerabilities_spec.rb
View file @
0317af90
...
...
@@ -134,7 +134,7 @@ RSpec.describe SetResolvedStateOnVulnerabilities do
describe
'#up'
do
it
'sets "resolved" state only for resolved vulnerabilities'
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
expect
(
find
(
vulnerability_open_id
)).
to
have_attributes
(
state:
states
[
:opened
],
resolved_by_id:
nil
,
resolved_at:
nil
)
...
...
ee/spec/models/analytics/cycle_analytics/group_level_spec.rb
View file @
0317af90
...
...
@@ -13,7 +13,7 @@ RSpec.describe Analytics::CycleAnalytics::GroupLevel do
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
mr
.
source_branch
,
sha:
mr
.
source_branch_sha
,
head_pipeline_of:
mr
)
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
subject
{
described_class
.
new
(
group:
group
,
options:
{
from:
from_date
,
current_user:
user
})
}
...
...
ee/spec/models/burndown_spec.rb
View file @
0317af90
...
...
@@ -223,7 +223,7 @@ RSpec.describe Burndown do
end
it
'avoids N+1 database queries'
do
Timecop
.
freeze
(
milestone
.
due_date
)
do
travel_to
(
milestone
.
due_date
)
do
create
(
:issue
,
milestone:
milestone
,
weight:
2
,
project:
project
,
author:
user
)
control_count
=
ActiveRecord
::
QueryRecorder
.
new
(
skip_cached:
false
)
do
...
...
ee/spec/models/ee/namespace_spec.rb
View file @
0317af90
...
...
@@ -1752,7 +1752,7 @@ RSpec.describe Namespace do
it
'sets a date'
do
namespace
=
build
(
:namespace
)
Timecop
.
freez
e
do
freeze_tim
e
do
namespace
.
enable_temporary_storage_increase!
expect
(
namespace
.
temporary_storage_increase_ends_on
).
to
eq
(
30
.
days
.
from_now
.
to_date
)
...
...
ee/spec/models/geo/project_registry_spec.rb
View file @
0317af90
...
...
@@ -550,7 +550,7 @@ RSpec.describe Geo::ProjectRegistry, :geo do
describe
'#start_sync!'
do
around
do
|
example
|
Timecop
.
freez
e
do
freeze_tim
e
do
example
.
run
end
end
...
...
@@ -609,7 +609,7 @@ RSpec.describe Geo::ProjectRegistry, :geo do
end
it
'sets last_repository_successful_sync_at to now'
do
Timecop
.
freez
e
do
freeze_tim
e
do
subject
.
finish_sync!
(
type
)
expect
(
subject
.
reload
.
last_repository_successful_sync_at
).
to
be_within
(
1
).
of
(
Time
.
current
)
...
...
@@ -704,7 +704,7 @@ RSpec.describe Geo::ProjectRegistry, :geo do
end
it
'sets last_wiki_successful_sync_at to now'
do
Timecop
.
freez
e
do
freeze_tim
e
do
subject
.
finish_sync!
(
type
)
expect
(
subject
.
reload
.
last_wiki_successful_sync_at
).
to
be_within
(
1
).
of
(
Time
.
current
)
...
...
ee/spec/models/productivity_analytics_spec.rb
View file @
0317af90
...
...
@@ -125,7 +125,7 @@ RSpec.describe ProductivityAnalytics do
end
before
do
Timecop
.
freez
e
do
freeze_tim
e
do
long_mr
medium_mr
short_mr
...
...
ee/spec/models/project_spec.rb
View file @
0317af90
...
...
@@ -353,7 +353,7 @@ RSpec.describe Project do
it
'creates import_state and sets next_execution_timestamp to now'
do
project
=
build
(
:project
,
:mirror
,
creator:
create
(
:user
))
Timecop
.
freez
e
do
freeze_tim
e
do
expect
do
project
.
save!
end
.
to
change
{
ProjectImportState
.
count
}.
by
(
1
)
...
...
@@ -368,7 +368,7 @@ RSpec.describe Project do
it
'creates import_state and sets next_execution_timestamp to now'
do
project
=
create
(
:project
)
Timecop
.
freez
e
do
freeze_tim
e
do
expect
do
project
.
update
(
mirror:
true
,
mirror_user_id:
project
.
creator
.
id
,
import_url:
generate
(
:url
))
end
.
to
change
{
ProjectImportState
.
count
}.
by
(
1
)
...
...
@@ -382,7 +382,7 @@ RSpec.describe Project do
it
'sets current import_state next_execution_timestamp to now'
do
project
=
create
(
:project
,
import_url:
generate
(
:url
))
Timecop
.
freez
e
do
freeze_tim
e
do
expect
do
project
.
update
(
mirror:
true
,
mirror_user_id:
project
.
creator
.
id
)
end
.
not_to
change
{
ProjectImportState
.
count
}
...
...
ee/spec/models/vulnerabilities/export_spec.rb
View file @
0317af90
...
...
@@ -72,7 +72,7 @@ RSpec.describe Vulnerabilities::Export do
subject
(
:vulnerability_export
)
{
create
(
:vulnerability_export
,
:csv
)
}
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
context
'when the export is new'
do
...
...
ee/spec/requests/api/vulnerabilities_spec.rb
View file @
0317af90
...
...
@@ -192,7 +192,7 @@ RSpec.describe API::Vulnerabilities do
end
it
'dismisses a vulnerability and its associated findings'
do
Timecop
.
freez
e
do
freeze_tim
e
do
dismiss_vulnerability
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
...
...
@@ -279,7 +279,7 @@ RSpec.describe API::Vulnerabilities do
end
it
'resolves a vulnerability and its associated findings'
do
Timecop
.
freez
e
do
freeze_tim
e
do
resolve_vulnerability
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
...
...
@@ -336,7 +336,7 @@ RSpec.describe API::Vulnerabilities do
end
it
'confirms a vulnerability and its associated findings'
do
Timecop
.
freez
e
do
freeze_tim
e
do
confirm_vulnerability
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
...
...
@@ -394,7 +394,7 @@ RSpec.describe API::Vulnerabilities do
end
it
'reverts a vulnerability and its associated findings to detected state'
do
Timecop
.
freez
e
do
freeze_tim
e
do
revert_vulnerability_to_detected
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
...
...
ee/spec/services/geo/file_download_service_spec.rb
View file @
0317af90
...
...
@@ -194,7 +194,7 @@ RSpec.describe Geo::FileDownloadService do
end
it
'sets a retry date and increments the retry count'
do
Timecop
.
freez
e
do
freeze_tim
e
do
execute!
expect
(
registry
.
last
.
reload
.
retry_count
).
to
eq
(
1
)
...
...
@@ -223,7 +223,7 @@ RSpec.describe Geo::FileDownloadService do
end
it
'sets a retry date and increments the retry count'
do
Timecop
.
freez
e
do
freeze_tim
e
do
execute!
expect
(
registry
.
last
.
reload
.
retry_count
).
to
eq
(
1
)
...
...
@@ -315,7 +315,7 @@ RSpec.describe Geo::FileDownloadService do
end
it
'sets a retry date and increments the retry count'
do
Timecop
.
freez
e
do
freeze_tim
e
do
execute!
expect
(
registry_entry
.
reload
.
retry_count
).
to
eq
(
4
)
...
...
@@ -326,7 +326,7 @@ RSpec.describe Geo::FileDownloadService do
it
'sets a retry date with a maximum of about 7 days'
do
registry_entry
.
update!
(
retry_count:
100
,
retry_at:
7
.
days
.
from_now
)
Timecop
.
freez
e
do
freeze_tim
e
do
execute!
expect
(
registry_entry
.
reload
.
retry_at
<
8
.
days
.
from_now
).
to
be_truthy
...
...
@@ -354,7 +354,7 @@ RSpec.describe Geo::FileDownloadService do
end
it
'sets a retry date and increments the retry count'
do
Timecop
.
freez
e
do
freeze_tim
e
do
execute!
expect
(
registry_entry
.
reload
.
retry_count
).
to
eq
(
4
)
...
...
@@ -365,7 +365,7 @@ RSpec.describe Geo::FileDownloadService do
it
'sets a retry date with a maximum of about 7 days'
do
registry_entry
.
update!
(
retry_count:
100
,
retry_at:
7
.
days
.
from_now
)
Timecop
.
freez
e
do
freeze_tim
e
do
execute!
expect
(
registry_entry
.
reload
.
retry_at
<
8
.
days
.
from_now
).
to
be_truthy
...
...
ee/spec/services/vulnerabilities/confirm_service_spec.rb
View file @
0317af90
...
...
@@ -25,7 +25,7 @@ RSpec.describe Vulnerabilities::ConfirmService do
it_behaves_like
'removes dismissal feedback from associated findings'
it
'confirms a vulnerability'
do
Timecop
.
freez
e
do
freeze_tim
e
do
confirm_vulnerability
expect
(
vulnerability
.
reload
).
to
(
...
...
ee/spec/services/vulnerabilities/dismiss_service_spec.rb
View file @
0317af90
...
...
@@ -30,7 +30,7 @@ RSpec.describe Vulnerabilities::DismissService do
let
(
:dismiss_findings
)
{
false
}
it
'dismisses only vulnerability'
do
Timecop
.
freez
e
do
freeze_tim
e
do
dismiss_vulnerability
expect
(
vulnerability
.
reload
).
to
(
...
...
@@ -42,7 +42,7 @@ RSpec.describe Vulnerabilities::DismissService do
context
'when the `dismiss_findings` argument is not false'
do
it
'dismisses a vulnerability and its associated findings'
do
Timecop
.
freez
e
do
freeze_tim
e
do
dismiss_vulnerability
expect
(
vulnerability
.
reload
).
to
(
...
...
@@ -57,7 +57,7 @@ RSpec.describe Vulnerabilities::DismissService do
let
(
:service
)
{
described_class
.
new
(
user
,
vulnerability
,
comment
)
}
it
'dismisses a vulnerability and its associated findings with comment'
,
:aggregate_failures
do
Timecop
.
freez
e
do
freeze_tim
e
do
dismiss_vulnerability
aggregate_failures
do
...
...
ee/spec/services/vulnerabilities/resolve_service_spec.rb
View file @
0317af90
...
...
@@ -25,7 +25,7 @@ RSpec.describe Vulnerabilities::ResolveService do
it_behaves_like
'removes dismissal feedback from associated findings'
it
'resolves a vulnerability'
do
Timecop
.
freez
e
do
freeze_tim
e
do
resolve_vulnerability
expect
(
vulnerability
.
reload
).
to
(
...
...
ee/spec/services/vulnerabilities/revert_to_detected_service_spec.rb
View file @
0317af90
...
...
@@ -18,7 +18,7 @@ RSpec.describe Vulnerabilities::RevertToDetectedService do
shared_examples
'reverts vulnerability'
do
it
'reverts a vulnerability and its associated findings to detected state'
do
Timecop
.
freez
e
do
freeze_tim
e
do
revert_vulnerability_to_detected
expect
(
vulnerability
.
reload
).
to
(
...
...
ee/spec/services/vulnerability_exports/export_service_spec.rb
View file @
0317af90
...
...
@@ -112,7 +112,7 @@ RSpec.describe VulnerabilityExports::ExportService do
end
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
it
'calls the VulnerabilityExports::Exporters::CsvService which sets the file and filename'
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