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
18aec09e
Commit
18aec09e
authored
Aug 26, 2020
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run autocorrection for RSpec/TimecopFreeze
Only on spec directory
parent
4b56bc52
Changes
84
Show whitespace changes
Inline
Side-by-side
Showing
84 changed files
with
124 additions
and
126 deletions
+124
-126
spec/controllers/projects/graphs_controller_spec.rb
spec/controllers/projects/graphs_controller_spec.rb
+1
-1
spec/controllers/projects/notes_controller_spec.rb
spec/controllers/projects/notes_controller_spec.rb
+1
-1
spec/features/boards/sidebar_spec.rb
spec/features/boards/sidebar_spec.rb
+1
-1
spec/features/groups/milestone_spec.rb
spec/features/groups/milestone_spec.rb
+1
-1
spec/features/projects/members/invite_group_spec.rb
spec/features/projects/members/invite_group_spec.rb
+1
-1
spec/features/users/login_spec.rb
spec/features/users/login_spec.rb
+1
-1
spec/lib/gitlab/alert_management/payload/prometheus_spec.rb
spec/lib/gitlab/alert_management/payload/prometheus_spec.rb
+1
-1
spec/lib/gitlab/app_text_logger_spec.rb
spec/lib/gitlab/app_text_logger_spec.rb
+1
-1
spec/lib/gitlab/ci/jwt_spec.rb
spec/lib/gitlab/ci/jwt_spec.rb
+1
-1
spec/lib/gitlab/conan_token_spec.rb
spec/lib/gitlab/conan_token_spec.rb
+1
-1
spec/lib/gitlab/cycle_analytics/code_stage_spec.rb
spec/lib/gitlab/cycle_analytics/code_stage_spec.rb
+2
-2
spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb
spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb
+3
-3
spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb
spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb
+2
-2
spec/lib/gitlab/cycle_analytics/review_stage_spec.rb
spec/lib/gitlab/cycle_analytics/review_stage_spec.rb
+2
-2
spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
+1
-1
spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb
spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb
+2
-2
spec/lib/gitlab/cycle_analytics/test_stage_spec.rb
spec/lib/gitlab/cycle_analytics/test_stage_spec.rb
+1
-1
spec/lib/gitlab/database/migrations/background_migration_helpers_spec.rb
.../database/migrations/background_migration_helpers_spec.rb
+1
-1
spec/lib/gitlab/external_authorization/access_spec.rb
spec/lib/gitlab/external_authorization/access_spec.rb
+5
-5
spec/lib/gitlab/external_authorization/cache_spec.rb
spec/lib/gitlab/external_authorization/cache_spec.rb
+2
-2
spec/lib/gitlab/github_import/importer/label_links_importer_spec.rb
...itlab/github_import/importer/label_links_importer_spec.rb
+1
-1
spec/lib/gitlab/github_import/importer/labels_importer_spec.rb
...lib/gitlab/github_import/importer/labels_importer_spec.rb
+2
-2
spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb
...lab/github_import/importer/pull_requests_importer_spec.rb
+1
-1
spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
...gitlab/github_import/importer/repository_importer_spec.rb
+1
-1
spec/lib/gitlab/incident_management/pager_duty/incident_issue_description_spec.rb
..._management/pager_duty/incident_issue_description_spec.rb
+1
-2
spec/lib/gitlab/log_timestamp_formatter_spec.rb
spec/lib/gitlab/log_timestamp_formatter_spec.rb
+1
-1
spec/lib/gitlab/metrics/method_call_spec.rb
spec/lib/gitlab/metrics/method_call_spec.rb
+1
-1
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
+1
-1
spec/lib/gitlab/phabricator_import/cache/map_spec.rb
spec/lib/gitlab/phabricator_import/cache/map_spec.rb
+1
-1
spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb
...heus/queries/additional_metrics_environment_query_spec.rb
+1
-1
spec/lib/gitlab/prometheus/queries/validate_query_spec.rb
spec/lib/gitlab/prometheus/queries/validate_query_spec.rb
+2
-2
spec/lib/gitlab/prometheus_client_spec.rb
spec/lib/gitlab/prometheus_client_spec.rb
+5
-5
spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing_spec.rb
...dleware/duplicate_jobs/strategies/until_executing_spec.rb
+1
-2
spec/lib/gitlab/updated_notes_paginator_spec.rb
spec/lib/gitlab/updated_notes_paginator_spec.rb
+1
-1
spec/migrations/20190924152703_migrate_issue_trackers_data_spec.rb
...ations/20190924152703_migrate_issue_trackers_data_spec.rb
+1
-1
spec/migrations/20200122123016_backfill_project_settings_spec.rb
...grations/20200122123016_backfill_project_settings_spec.rb
+1
-1
spec/migrations/20200130145430_reschedule_migrate_issue_trackers_data_spec.rb
...0130145430_reschedule_migrate_issue_trackers_data_spec.rb
+1
-1
spec/migrations/20200406102120_backfill_deployment_clusters_from_deployments_spec.rb
...120_backfill_deployment_clusters_from_deployments_spec.rb
+1
-1
spec/migrations/20200703125016_backfill_namespace_settings_spec.rb
...ations/20200703125016_backfill_namespace_settings_spec.rb
+1
-1
spec/migrations/backfill_imported_snippet_repositories_spec.rb
...migrations/backfill_imported_snippet_repositories_spec.rb
+1
-1
spec/migrations/backfill_snippet_repositories_spec.rb
spec/migrations/backfill_snippet_repositories_spec.rb
+1
-1
spec/migrations/enqueue_reset_merge_status_second_run_spec.rb
.../migrations/enqueue_reset_merge_status_second_run_spec.rb
+1
-1
spec/migrations/enqueue_reset_merge_status_spec.rb
spec/migrations/enqueue_reset_merge_status_spec.rb
+1
-1
spec/migrations/fix_projects_without_project_feature_spec.rb
spec/migrations/fix_projects_without_project_feature_spec.rb
+1
-1
spec/migrations/fix_projects_without_prometheus_services_spec.rb
...grations/fix_projects_without_prometheus_services_spec.rb
+1
-1
spec/migrations/fix_wrong_pages_access_level_spec.rb
spec/migrations/fix_wrong_pages_access_level_spec.rb
+1
-1
spec/migrations/migrate_discussion_id_on_promoted_epics_spec.rb
...igrations/migrate_discussion_id_on_promoted_epics_spec.rb
+2
-2
spec/migrations/schedule_calculate_wiki_sizes_spec.rb
spec/migrations/schedule_calculate_wiki_sizes_spec.rb
+2
-2
spec/migrations/schedule_fill_valid_time_for_pages_domain_certificates_spec.rb
...ule_fill_valid_time_for_pages_domain_certificates_spec.rb
+1
-1
spec/migrations/schedule_migrate_security_scans_spec.rb
spec/migrations/schedule_migrate_security_scans_spec.rb
+2
-2
spec/migrations/schedule_pages_metadata_migration_spec.rb
spec/migrations/schedule_pages_metadata_migration_spec.rb
+1
-1
spec/migrations/schedule_populate_merge_request_assignees_table_spec.rb
...s/schedule_populate_merge_request_assignees_table_spec.rb
+1
-1
spec/migrations/schedule_populate_personal_snippet_statistics_spec.rb
...ons/schedule_populate_personal_snippet_statistics_spec.rb
+1
-1
spec/migrations/schedule_populate_project_snippet_statistics_spec.rb
...ions/schedule_populate_project_snippet_statistics_spec.rb
+1
-1
spec/migrations/schedule_populate_user_highest_roles_table_spec.rb
...ations/schedule_populate_user_highest_roles_table_spec.rb
+1
-1
spec/migrations/schedule_recalculate_project_authorizations_second_run_spec.rb
...ule_recalculate_project_authorizations_second_run_spec.rb
+1
-1
spec/migrations/schedule_recalculate_project_authorizations_spec.rb
...tions/schedule_recalculate_project_authorizations_spec.rb
+2
-2
spec/migrations/schedule_recalculate_project_authorizations_third_run_spec.rb
...dule_recalculate_project_authorizations_third_run_spec.rb
+1
-1
spec/migrations/schedule_sync_issuables_state_id_spec.rb
spec/migrations/schedule_sync_issuables_state_id_spec.rb
+1
-1
spec/migrations/schedule_sync_issuables_state_id_where_nil_spec.rb
...ations/schedule_sync_issuables_state_id_where_nil_spec.rb
+1
-1
spec/migrations/schedule_update_existing_subgroup_to_match_visibility_level_of_parent_spec.rb
...ting_subgroup_to_match_visibility_level_of_parent_spec.rb
+4
-4
spec/models/board_group_recent_visit_spec.rb
spec/models/board_group_recent_visit_spec.rb
+1
-1
spec/models/board_project_recent_visit_spec.rb
spec/models/board_project_recent_visit_spec.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+4
-4
spec/models/clusters/applications/prometheus_spec.rb
spec/models/clusters/applications/prometheus_spec.rb
+2
-2
spec/models/concerns/prometheus_adapter_spec.rb
spec/models/concerns/prometheus_adapter_spec.rb
+5
-5
spec/models/deployment_spec.rb
spec/models/deployment_spec.rb
+5
-5
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+2
-2
spec/models/metrics/dashboard/annotation_spec.rb
spec/models/metrics/dashboard/annotation_spec.rb
+1
-1
spec/models/remote_mirror_spec.rb
spec/models/remote_mirror_spec.rb
+2
-2
spec/presenters/ci/build_presenter_spec.rb
spec/presenters/ci/build_presenter_spec.rb
+3
-3
spec/requests/api/conan_packages_spec.rb
spec/requests/api/conan_packages_spec.rb
+1
-1
spec/requests/api/internal/base_spec.rb
spec/requests/api/internal/base_spec.rb
+1
-1
spec/serializers/analytics_build_entity_spec.rb
spec/serializers/analytics_build_entity_spec.rb
+1
-1
spec/services/clusters/applications/schedule_update_service_spec.rb
...ces/clusters/applications/schedule_update_service_spec.rb
+1
-1
spec/services/deployments/after_create_service_spec.rb
spec/services/deployments/after_create_service_spec.rb
+1
-1
spec/services/merge_requests/delete_non_latest_diffs_service_spec.rb
...es/merge_requests/delete_non_latest_diffs_service_spec.rb
+1
-1
spec/services/note_summary_spec.rb
spec/services/note_summary_spec.rb
+1
-1
spec/services/projects/hashed_storage/base_attachment_service_spec.rb
...s/projects/hashed_storage/base_attachment_service_spec.rb
+1
-1
spec/services/releases/create_service_spec.rb
spec/services/releases/create_service_spec.rb
+1
-1
spec/support/shared_examples/lib/gitlab/background_migration/mentions_migration_shared_examples.rb
...ackground_migration/mentions_migration_shared_examples.rb
+1
-1
spec/support/shared_examples/models/throttled_touch_shared_examples.rb
...shared_examples/models/throttled_touch_shared_examples.rb
+1
-1
spec/workers/cluster_update_app_worker_spec.rb
spec/workers/cluster_update_app_worker_spec.rb
+1
-1
spec/workers/repository_update_remote_mirror_worker_spec.rb
spec/workers/repository_update_remote_mirror_worker_spec.rb
+1
-1
No files found.
spec/controllers/projects/graphs_controller_spec.rb
View file @
18aec09e
...
@@ -44,7 +44,7 @@ RSpec.describe Projects::GraphsController do
...
@@ -44,7 +44,7 @@ RSpec.describe Projects::GraphsController do
context
'when anonymous users can read build report results'
do
context
'when anonymous users can read build report results'
do
it
'sets the daily coverage options'
do
it
'sets the daily coverage options'
do
Timecop
.
freez
e
do
freeze_tim
e
do
get
(
:charts
,
params:
{
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
id:
'master'
})
get
(
:charts
,
params:
{
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
id:
'master'
})
expect
(
assigns
[
:daily_coverage_options
]).
to
eq
(
expect
(
assigns
[
:daily_coverage_options
]).
to
eq
(
...
...
spec/controllers/projects/notes_controller_spec.rb
View file @
18aec09e
...
@@ -98,7 +98,7 @@ RSpec.describe Projects::NotesController do
...
@@ -98,7 +98,7 @@ RSpec.describe Projects::NotesController do
let
(
:page_2_boundary
)
{
microseconds
(
page_2
.
last
.
updated_at
+
NotesFinder
::
FETCH_OVERLAP
)
}
let
(
:page_2_boundary
)
{
microseconds
(
page_2
.
last
.
updated_at
+
NotesFinder
::
FETCH_OVERLAP
)
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
do
freeze_tim
e
do
example
.
run
example
.
run
end
end
end
end
...
...
spec/features/boards/sidebar_spec.rb
View file @
18aec09e
...
@@ -23,7 +23,7 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -23,7 +23,7 @@ RSpec.describe 'Issue Boards', :js do
let
(
:application_settings
)
{
{}
}
let
(
:application_settings
)
{
{}
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
before
do
before
do
...
...
spec/features/groups/milestone_spec.rb
View file @
18aec09e
...
@@ -8,7 +8,7 @@ RSpec.describe 'Group milestones' do
...
@@ -8,7 +8,7 @@ RSpec.describe 'Group milestones' do
let_it_be
(
:user
)
{
create
(
:group_member
,
:maintainer
,
user:
create
(
:user
),
group:
group
).
user
}
let_it_be
(
:user
)
{
create
(
:group_member
,
:maintainer
,
user:
create
(
:user
),
group:
group
).
user
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
before
do
before
do
...
...
spec/features/projects/members/invite_group_spec.rb
View file @
18aec09e
...
@@ -112,7 +112,7 @@ RSpec.describe 'Project > Members > Invite group', :js do
...
@@ -112,7 +112,7 @@ RSpec.describe 'Project > Members > Invite group', :js do
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:group
)
{
create
(
:group
)
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
before
do
before
do
...
...
spec/features/users/login_spec.rb
View file @
18aec09e
...
@@ -503,7 +503,7 @@ RSpec.describe 'Login' do
...
@@ -503,7 +503,7 @@ RSpec.describe 'Login' do
context
'within the grace period'
do
context
'within the grace period'
do
it
'redirects to two-factor configuration page'
do
it
'redirects to two-factor configuration page'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
authentication_metrics
)
expect
(
authentication_metrics
)
.
to
increment
(
:user_authenticated_counter
)
.
to
increment
(
:user_authenticated_counter
)
...
...
spec/lib/gitlab/alert_management/payload/prometheus_spec.rb
View file @
18aec09e
...
@@ -45,7 +45,7 @@ RSpec.describe Gitlab::AlertManagement::Payload::Prometheus do
...
@@ -45,7 +45,7 @@ RSpec.describe Gitlab::AlertManagement::Payload::Prometheus do
let
(
:current_time
)
{
Time
.
current
.
utc
}
let
(
:current_time
)
{
Time
.
current
.
utc
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
subject
{
parsed_payload
.
starts_at
}
subject
{
parsed_payload
.
starts_at
}
...
...
spec/lib/gitlab/app_text_logger_spec.rb
View file @
18aec09e
...
@@ -17,7 +17,7 @@ RSpec.describe Gitlab::AppTextLogger do
...
@@ -17,7 +17,7 @@ RSpec.describe Gitlab::AppTextLogger do
end
end
it
'logs time in UTC with ISO8601.3 standard'
do
it
'logs time in UTC with ISO8601.3 standard'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
subject
.
format_message
(
'INFO'
,
Time
.
now
,
nil
,
string_message
))
expect
(
subject
.
format_message
(
'INFO'
,
Time
.
now
,
nil
,
string_message
))
.
to
include
(
Time
.
now
.
utc
.
iso8601
(
3
))
.
to
include
(
Time
.
now
.
utc
.
iso8601
(
3
))
end
end
...
...
spec/lib/gitlab/ci/jwt_spec.rb
View file @
18aec09e
...
@@ -20,7 +20,7 @@ RSpec.describe Gitlab::Ci::Jwt do
...
@@ -20,7 +20,7 @@ RSpec.describe Gitlab::Ci::Jwt do
subject
(
:payload
)
{
described_class
.
new
(
build
,
ttl:
30
).
payload
}
subject
(
:payload
)
{
described_class
.
new
(
build
,
ttl:
30
).
payload
}
it
'has correct values for the standard JWT attributes'
do
it
'has correct values for the standard JWT attributes'
do
Timecop
.
freez
e
do
freeze_tim
e
do
now
=
Time
.
now
.
to_i
now
=
Time
.
now
.
to_i
aggregate_failures
do
aggregate_failures
do
...
...
spec/lib/gitlab/conan_token_spec.rb
View file @
18aec09e
...
@@ -85,7 +85,7 @@ RSpec.describe Gitlab::ConanToken do
...
@@ -85,7 +85,7 @@ RSpec.describe Gitlab::ConanToken do
it
'returns the encoded JWT'
do
it
'returns the encoded JWT'
do
allow
(
SecureRandom
).
to
receive
(
:uuid
).
and_return
(
'u-u-i-d'
)
allow
(
SecureRandom
).
to
receive
(
:uuid
).
and_return
(
'u-u-i-d'
)
Timecop
.
freez
e
do
freeze_tim
e
do
jwt
=
build_jwt
(
access_token_id:
123
,
user_id:
456
)
jwt
=
build_jwt
(
access_token_id:
123
,
user_id:
456
)
token
=
described_class
.
new
(
access_token_id:
123
,
user_id:
456
)
token
=
described_class
.
new
(
access_token_id:
123
,
user_id:
456
)
...
...
spec/lib/gitlab/cycle_analytics/code_stage_spec.rb
View file @
18aec09e
...
@@ -34,7 +34,7 @@ RSpec.describe Gitlab::CycleAnalytics::CodeStage do
...
@@ -34,7 +34,7 @@ RSpec.describe Gitlab::CycleAnalytics::CodeStage do
describe
'#project_median'
do
describe
'#project_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
@@ -76,7 +76,7 @@ RSpec.describe Gitlab::CycleAnalytics::CodeStage do
...
@@ -76,7 +76,7 @@ RSpec.describe Gitlab::CycleAnalytics::CodeStage do
describe
'#group_median'
do
describe
'#group_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
...
spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb
View file @
18aec09e
...
@@ -29,7 +29,7 @@ RSpec.describe Gitlab::CycleAnalytics::IssueStage do
...
@@ -29,7 +29,7 @@ RSpec.describe Gitlab::CycleAnalytics::IssueStage do
describe
'#median'
do
describe
'#median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
@@ -65,7 +65,7 @@ RSpec.describe Gitlab::CycleAnalytics::IssueStage do
...
@@ -65,7 +65,7 @@ RSpec.describe Gitlab::CycleAnalytics::IssueStage do
describe
'#group_median'
do
describe
'#group_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
@@ -87,7 +87,7 @@ RSpec.describe Gitlab::CycleAnalytics::IssueStage do
...
@@ -87,7 +87,7 @@ RSpec.describe Gitlab::CycleAnalytics::IssueStage do
describe
'#group_median'
do
describe
'#group_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
...
spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb
View file @
18aec09e
...
@@ -29,7 +29,7 @@ RSpec.describe Gitlab::CycleAnalytics::PlanStage do
...
@@ -29,7 +29,7 @@ RSpec.describe Gitlab::CycleAnalytics::PlanStage do
describe
'#project_median'
do
describe
'#project_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
@@ -67,7 +67,7 @@ RSpec.describe Gitlab::CycleAnalytics::PlanStage do
...
@@ -67,7 +67,7 @@ RSpec.describe Gitlab::CycleAnalytics::PlanStage do
describe
'#group_median'
do
describe
'#group_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
...
spec/lib/gitlab/cycle_analytics/review_stage_spec.rb
View file @
18aec09e
...
@@ -27,7 +27,7 @@ RSpec.describe Gitlab::CycleAnalytics::ReviewStage do
...
@@ -27,7 +27,7 @@ RSpec.describe Gitlab::CycleAnalytics::ReviewStage do
describe
'#project_median'
do
describe
'#project_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
@@ -70,7 +70,7 @@ RSpec.describe Gitlab::CycleAnalytics::ReviewStage do
...
@@ -70,7 +70,7 @@ RSpec.describe Gitlab::CycleAnalytics::ReviewStage do
describe
'#group_median'
do
describe
'#group_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
...
spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
View file @
18aec09e
...
@@ -231,7 +231,7 @@ RSpec.describe Gitlab::CycleAnalytics::StageSummary do
...
@@ -231,7 +231,7 @@ RSpec.describe Gitlab::CycleAnalytics::StageSummary do
context
'when `from` and `to` are within a day'
do
context
'when `from` and `to` are within a day'
do
it
'returns the number of deployments made on that day'
do
it
'returns the number of deployments made on that day'
do
Timecop
.
freeze
(
Time
.
now
)
do
freeze_time
do
create
(
:deployment
,
:success
,
project:
project
)
create
(
:deployment
,
:success
,
project:
project
)
options
[
:from
]
=
options
[
:to
]
=
Time
.
now
options
[
:from
]
=
options
[
:to
]
=
Time
.
now
...
...
spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb
View file @
18aec09e
...
@@ -32,7 +32,7 @@ RSpec.describe Gitlab::CycleAnalytics::StagingStage do
...
@@ -32,7 +32,7 @@ RSpec.describe Gitlab::CycleAnalytics::StagingStage do
describe
'#project_median'
do
describe
'#project_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
@@ -79,7 +79,7 @@ RSpec.describe Gitlab::CycleAnalytics::StagingStage do
...
@@ -79,7 +79,7 @@ RSpec.describe Gitlab::CycleAnalytics::StagingStage do
describe
'#group_median'
do
describe
'#group_median'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
...
spec/lib/gitlab/cycle_analytics/test_stage_spec.rb
View file @
18aec09e
...
@@ -37,7 +37,7 @@ RSpec.describe Gitlab::CycleAnalytics::TestStage do
...
@@ -37,7 +37,7 @@ RSpec.describe Gitlab::CycleAnalytics::TestStage do
end
end
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'counts median from issues with metrics'
do
it
'counts median from issues with metrics'
do
...
...
spec/lib/gitlab/database/migrations/background_migration_helpers_spec.rb
View file @
18aec09e
...
@@ -86,7 +86,7 @@ RSpec.describe Gitlab::Database::Migrations::BackgroundMigrationHelpers do
...
@@ -86,7 +86,7 @@ RSpec.describe Gitlab::Database::Migrations::BackgroundMigrationHelpers do
let!
(
:id3
)
{
create
(
:user
).
id
}
let!
(
:id3
)
{
create
(
:user
).
id
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
before
do
before
do
...
...
spec/lib/gitlab/external_authorization/access_spec.rb
View file @
18aec09e
...
@@ -7,7 +7,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
...
@@ -7,7 +7,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
describe
'#loaded?'
do
describe
'#loaded?'
do
it
'is `true` when it was loaded recently'
do
it
'is `true` when it was loaded recently'
do
Timecop
.
freez
e
do
freeze_tim
e
do
allow
(
access
).
to
receive
(
:loaded_at
).
and_return
(
5
.
minutes
.
ago
)
allow
(
access
).
to
receive
(
:loaded_at
).
and_return
(
5
.
minutes
.
ago
)
expect
(
access
).
to
be_loaded
expect
(
access
).
to
be_loaded
...
@@ -19,7 +19,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
...
@@ -19,7 +19,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
end
end
it
'is `false` when there the result was loaded a long time ago'
do
it
'is `false` when there the result was loaded a long time ago'
do
Timecop
.
freez
e
do
freeze_tim
e
do
allow
(
access
).
to
receive
(
:loaded_at
).
and_return
(
2
.
weeks
.
ago
)
allow
(
access
).
to
receive
(
:loaded_at
).
and_return
(
2
.
weeks
.
ago
)
expect
(
access
).
not_to
be_loaded
expect
(
access
).
not_to
be_loaded
...
@@ -70,7 +70,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
...
@@ -70,7 +70,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
end
end
it
'stores the result in redis'
do
it
'stores the result in redis'
do
Timecop
.
freez
e
do
freeze_tim
e
do
fake_cache
=
double
fake_cache
=
double
expect
(
fake_cache
).
to
receive
(
:store
).
with
(
true
,
nil
,
Time
.
now
)
expect
(
fake_cache
).
to
receive
(
:store
).
with
(
true
,
nil
,
Time
.
now
)
expect
(
access
).
to
receive
(
:cache
).
and_return
(
fake_cache
)
expect
(
access
).
to
receive
(
:cache
).
and_return
(
fake_cache
)
...
@@ -118,7 +118,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
...
@@ -118,7 +118,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
end
end
it
'does not load from the webservice'
do
it
'does not load from the webservice'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
fake_cache
).
to
receive
(
:load
).
and_return
([
true
,
nil
,
Time
.
now
])
expect
(
fake_cache
).
to
receive
(
:load
).
and_return
([
true
,
nil
,
Time
.
now
])
expect
(
access
).
to
receive
(
:load_from_cache
).
and_call_original
expect
(
access
).
to
receive
(
:load_from_cache
).
and_call_original
...
@@ -129,7 +129,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
...
@@ -129,7 +129,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache
end
end
it
'loads from the webservice when the cached result was too old'
do
it
'loads from the webservice when the cached result was too old'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
fake_cache
).
to
receive
(
:load
).
and_return
([
true
,
nil
,
2
.
days
.
ago
])
expect
(
fake_cache
).
to
receive
(
:load
).
and_return
([
true
,
nil
,
2
.
days
.
ago
])
expect
(
access
).
to
receive
(
:load_from_cache
).
and_call_original
expect
(
access
).
to
receive
(
:load_from_cache
).
and_call_original
...
...
spec/lib/gitlab/external_authorization/cache_spec.rb
View file @
18aec09e
...
@@ -22,7 +22,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Cache, :clean_gitlab_redis_cache d
...
@@ -22,7 +22,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Cache, :clean_gitlab_redis_cache d
describe
'#load'
do
describe
'#load'
do
it
'reads stored info from redis'
do
it
'reads stored info from redis'
do
Timecop
.
freez
e
do
freeze_tim
e
do
set_in_redis
(
:access
,
false
)
set_in_redis
(
:access
,
false
)
set_in_redis
(
:reason
,
'Access denied for now'
)
set_in_redis
(
:reason
,
'Access denied for now'
)
set_in_redis
(
:refreshed_at
,
Time
.
now
)
set_in_redis
(
:refreshed_at
,
Time
.
now
)
...
@@ -38,7 +38,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Cache, :clean_gitlab_redis_cache d
...
@@ -38,7 +38,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Cache, :clean_gitlab_redis_cache d
describe
'#store'
do
describe
'#store'
do
it
'sets the values in redis'
do
it
'sets the values in redis'
do
Timecop
.
freez
e
do
freeze_tim
e
do
cache
.
store
(
true
,
'the reason'
,
Time
.
now
)
cache
.
store
(
true
,
'the reason'
,
Time
.
now
)
expect
(
read_from_redis
(
:access
)).
to
eq
(
'true'
)
expect
(
read_from_redis
(
:access
)).
to
eq
(
'true'
)
...
...
spec/lib/gitlab/github_import/importer/label_links_importer_spec.rb
View file @
18aec09e
...
@@ -38,7 +38,7 @@ RSpec.describe Gitlab::GithubImport::Importer::LabelLinksImporter do
...
@@ -38,7 +38,7 @@ RSpec.describe Gitlab::GithubImport::Importer::LabelLinksImporter do
.
to
receive
(
:find_target_id
)
.
to
receive
(
:find_target_id
)
.
and_return
(
1
)
.
and_return
(
1
)
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
Gitlab
::
Database
)
expect
(
Gitlab
::
Database
)
.
to
receive
(
:bulk_insert
)
.
to
receive
(
:bulk_insert
)
.
with
(
.
with
(
...
...
spec/lib/gitlab/github_import/importer/labels_importer_spec.rb
View file @
18aec09e
...
@@ -85,13 +85,13 @@ RSpec.describe Gitlab::GithubImport::Importer::LabelsImporter, :clean_gitlab_red
...
@@ -85,13 +85,13 @@ RSpec.describe Gitlab::GithubImport::Importer::LabelsImporter, :clean_gitlab_red
end
end
it
'includes the created timestamp'
do
it
'includes the created timestamp'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
label_hash
[
:created_at
]).
to
eq
(
Time
.
zone
.
now
)
expect
(
label_hash
[
:created_at
]).
to
eq
(
Time
.
zone
.
now
)
end
end
end
end
it
'includes the updated timestamp'
do
it
'includes the updated timestamp'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
label_hash
[
:updated_at
]).
to
eq
(
Time
.
zone
.
now
)
expect
(
label_hash
[
:updated_at
]).
to
eq
(
Time
.
zone
.
now
)
end
end
end
end
...
...
spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb
View file @
18aec09e
...
@@ -164,7 +164,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestsImporter do
...
@@ -164,7 +164,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestsImporter do
.
to
receive
(
:increment
)
.
to
receive
(
:increment
)
.
and_call_original
.
and_call_original
Timecop
.
freez
e
do
freeze_tim
e
do
importer
.
update_repository
importer
.
update_repository
expect
(
project
.
last_repository_updated_at
).
to
be_like_time
(
Time
.
zone
.
now
)
expect
(
project
.
last_repository_updated_at
).
to
be_like_time
(
Time
.
zone
.
now
)
...
...
spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
View file @
18aec09e
...
@@ -261,7 +261,7 @@ RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter do
...
@@ -261,7 +261,7 @@ RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter do
describe
'#update_clone_time'
do
describe
'#update_clone_time'
do
it
'sets the timestamp for when the cloning process finished'
do
it
'sets the timestamp for when the cloning process finished'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
project
)
expect
(
project
)
.
to
receive
(
:update_column
)
.
to
receive
(
:update_column
)
.
with
(
:last_repository_updated_at
,
Time
.
zone
.
now
)
.
with
(
:last_repository_updated_at
,
Time
.
zone
.
now
)
...
...
spec/lib/gitlab/incident_management/pager_duty/incident_issue_description_spec.rb
View file @
18aec09e
# frozen_string_literal: true
# frozen_string_literal: true
require
'fast_spec_helper'
require
'fast_spec_helper'
require
'timecop'
RSpec
.
describe
Gitlab
::
IncidentManagement
::
PagerDuty
::
IncidentIssueDescription
do
RSpec
.
describe
Gitlab
::
IncidentManagement
::
PagerDuty
::
IncidentIssueDescription
do
describe
'#to_s'
do
describe
'#to_s'
do
...
@@ -50,7 +49,7 @@ RSpec.describe Gitlab::IncidentManagement::PagerDuty::IncidentIssueDescription d
...
@@ -50,7 +49,7 @@ RSpec.describe Gitlab::IncidentManagement::PagerDuty::IncidentIssueDescription d
let
(
:created_at
)
{
nil
}
let
(
:created_at
)
{
nil
}
it
'description contains current time in UTC'
do
it
'description contains current time in UTC'
do
Timecop
.
freez
e
do
freeze_tim
e
do
now
=
Time
.
current
.
utc
.
strftime
(
'%d %B %Y, %-l:%M%p (%Z)'
)
now
=
Time
.
current
.
utc
.
strftime
(
'%d %B %Y, %-l:%M%p (%Z)'
)
expect
(
to_s
).
to
include
(
expect
(
to_s
).
to
include
(
...
...
spec/lib/gitlab/log_timestamp_formatter_spec.rb
View file @
18aec09e
...
@@ -8,7 +8,7 @@ RSpec.describe Gitlab::LogTimestampFormatter do
...
@@ -8,7 +8,7 @@ RSpec.describe Gitlab::LogTimestampFormatter do
let
(
:formatted_timestamp
)
{
Time
.
now
.
utc
.
iso8601
(
3
)
}
let
(
:formatted_timestamp
)
{
Time
.
now
.
utc
.
iso8601
(
3
)
}
it
'logs the timestamp in UTC and ISO8601.3 format'
do
it
'logs the timestamp in UTC and ISO8601.3 format'
do
Timecop
.
freeze
(
Time
.
now
)
do
freeze_time
do
expect
(
subject
.
call
(
''
,
Time
.
now
,
''
,
''
)).
to
include
formatted_timestamp
expect
(
subject
.
call
(
''
,
Time
.
now
,
''
,
''
)).
to
include
formatted_timestamp
end
end
end
end
...
...
spec/lib/gitlab/metrics/method_call_spec.rb
View file @
18aec09e
...
@@ -30,7 +30,7 @@ RSpec.describe Gitlab::Metrics::MethodCall do
...
@@ -30,7 +30,7 @@ RSpec.describe Gitlab::Metrics::MethodCall do
end
end
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
do
freeze_tim
e
do
example
.
run
example
.
run
end
end
end
end
...
...
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
View file @
18aec09e
...
@@ -12,7 +12,7 @@ RSpec.describe Gitlab::Metrics::Samplers::RubySampler do
...
@@ -12,7 +12,7 @@ RSpec.describe Gitlab::Metrics::Samplers::RubySampler do
describe
'#initialize'
do
describe
'#initialize'
do
it
'sets process_start_time_seconds'
do
it
'sets process_start_time_seconds'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
sampler
.
metrics
[
:process_start_time_seconds
].
get
).
to
eq
(
Time
.
now
.
to_i
)
expect
(
sampler
.
metrics
[
:process_start_time_seconds
].
get
).
to
eq
(
Time
.
now
.
to_i
)
end
end
end
end
...
...
spec/lib/gitlab/phabricator_import/cache/map_spec.rb
View file @
18aec09e
...
@@ -50,7 +50,7 @@ RSpec.describe Gitlab::PhabricatorImport::Cache::Map, :clean_gitlab_redis_cache
...
@@ -50,7 +50,7 @@ RSpec.describe Gitlab::PhabricatorImport::Cache::Map, :clean_gitlab_redis_cache
describe
'#set_gitlab_model'
do
describe
'#set_gitlab_model'
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'sets the class and id in redis with a ttl'
do
it
'sets the class and id in redis with a ttl'
do
...
...
spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb
View file @
18aec09e
...
@@ -4,7 +4,7 @@ require 'spec_helper'
...
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec
.
describe
Gitlab
::
Prometheus
::
Queries
::
AdditionalMetricsEnvironmentQuery
do
RSpec
.
describe
Gitlab
::
Prometheus
::
Queries
::
AdditionalMetricsEnvironmentQuery
do
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
include_examples
'additional metrics query'
do
include_examples
'additional metrics query'
do
...
...
spec/lib/gitlab/prometheus/queries/validate_query_spec.rb
View file @
18aec09e
...
@@ -28,7 +28,7 @@ RSpec.describe Gitlab::Prometheus::Queries::ValidateQuery do
...
@@ -28,7 +28,7 @@ RSpec.describe Gitlab::Prometheus::Queries::ValidateQuery do
let
(
:error_message
)
{
"invalid parameter 'query': 1:9: parse error: unexpected identifier
\"
query
\"
"
}
let
(
:error_message
)
{
"invalid parameter 'query': 1:9: parse error: unexpected identifier
\"
query
\"
"
}
it
'returns invalid'
do
it
'returns invalid'
do
Timecop
.
freez
e
do
freeze_tim
e
do
stub_prometheus_query_error
(
stub_prometheus_query_error
(
prometheus_query_with_time_url
(
query
,
Time
.
now
),
prometheus_query_with_time_url
(
query
,
Time
.
now
),
error_message
error_message
...
@@ -53,7 +53,7 @@ RSpec.describe Gitlab::Prometheus::Queries::ValidateQuery do
...
@@ -53,7 +53,7 @@ RSpec.describe Gitlab::Prometheus::Queries::ValidateQuery do
end
end
it
'catches exception and returns invalid'
do
it
'catches exception and returns invalid'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
subject
.
query
(
query
)).
to
eq
(
valid:
false
,
error:
message
)
expect
(
subject
.
query
(
query
)).
to
eq
(
valid:
false
,
error:
message
)
end
end
end
end
...
...
spec/lib/gitlab/prometheus_client_spec.rb
View file @
18aec09e
...
@@ -136,7 +136,7 @@ RSpec.describe Gitlab::PrometheusClient do
...
@@ -136,7 +136,7 @@ RSpec.describe Gitlab::PrometheusClient do
let
(
:query_url
)
{
prometheus_query_with_time_url
(
prometheus_query
,
Time
.
now
.
utc
)
}
let
(
:query_url
)
{
prometheus_query_with_time_url
(
prometheus_query
,
Time
.
now
.
utc
)
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'when request returns vector results'
do
context
'when request returns vector results'
do
...
@@ -195,7 +195,7 @@ RSpec.describe Gitlab::PrometheusClient do
...
@@ -195,7 +195,7 @@ RSpec.describe Gitlab::PrometheusClient do
let
(
:query_url
)
{
prometheus_query_with_time_url
(
query
,
Time
.
now
.
utc
)
}
let
(
:query_url
)
{
prometheus_query_with_time_url
(
query
,
Time
.
now
.
utc
)
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'when request returns vector results'
do
context
'when request returns vector results'
do
...
@@ -228,7 +228,7 @@ RSpec.describe Gitlab::PrometheusClient do
...
@@ -228,7 +228,7 @@ RSpec.describe Gitlab::PrometheusClient do
let
(
:query_url
)
{
prometheus_series_url
(
'series_name'
,
'other_service'
)
}
let
(
:query_url
)
{
prometheus_series_url
(
'series_name'
,
'other_service'
)
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'calls endpoint and returns list of series'
do
it
'calls endpoint and returns list of series'
do
...
@@ -259,7 +259,7 @@ RSpec.describe Gitlab::PrometheusClient do
...
@@ -259,7 +259,7 @@ RSpec.describe Gitlab::PrometheusClient do
let
(
:query_url
)
{
prometheus_query_range_url
(
prometheus_query
)
}
let
(
:query_url
)
{
prometheus_query_range_url
(
prometheus_query
)
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'when non utc time is passed'
do
context
'when non utc time is passed'
do
...
@@ -358,7 +358,7 @@ RSpec.describe Gitlab::PrometheusClient do
...
@@ -358,7 +358,7 @@ RSpec.describe Gitlab::PrometheusClient do
let
(
:query_url
)
{
prometheus_query_url
(
prometheus_query
)
}
let
(
:query_url
)
{
prometheus_query_url
(
prometheus_query
)
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'when response status code is 200'
do
context
'when response status code is 200'
do
...
...
spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing_spec.rb
View file @
18aec09e
# frozen_string_literal: true
# frozen_string_literal: true
require
'fast_spec_helper'
require
'fast_spec_helper'
require
'timecop'
RSpec
.
describe
Gitlab
::
SidekiqMiddleware
::
DuplicateJobs
::
Strategies
::
UntilExecuting
do
RSpec
.
describe
Gitlab
::
SidekiqMiddleware
::
DuplicateJobs
::
Strategies
::
UntilExecuting
do
let
(
:fake_duplicate_job
)
do
let
(
:fake_duplicate_job
)
do
...
@@ -77,7 +76,7 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::Strategies::UntilExecut
...
@@ -77,7 +76,7 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::Strategies::UntilExecut
context
'scheduled in the future'
do
context
'scheduled in the future'
do
it
'adds the jid of the existing job to the job hash'
do
it
'adds the jid of the existing job to the job hash'
do
Timecop
.
freez
e
do
freeze_tim
e
do
allow
(
fake_duplicate_job
).
to
receive
(
:scheduled?
).
twice
.
and_return
(
true
)
allow
(
fake_duplicate_job
).
to
receive
(
:scheduled?
).
twice
.
and_return
(
true
)
allow
(
fake_duplicate_job
).
to
receive
(
:scheduled_at
).
and_return
(
Time
.
now
+
time_diff
)
allow
(
fake_duplicate_job
).
to
receive
(
:scheduled_at
).
and_return
(
Time
.
now
+
time_diff
)
allow
(
fake_duplicate_job
).
to
receive
(
:options
).
and_return
({
including_scheduled:
true
})
allow
(
fake_duplicate_job
).
to
receive
(
:options
).
and_return
({
including_scheduled:
true
})
...
...
spec/lib/gitlab/updated_notes_paginator_spec.rb
View file @
18aec09e
...
@@ -15,7 +15,7 @@ RSpec.describe Gitlab::UpdatedNotesPaginator do
...
@@ -15,7 +15,7 @@ RSpec.describe Gitlab::UpdatedNotesPaginator do
let
(
:page_1_boundary
)
{
page_1
.
last
.
updated_at
+
NotesFinder
::
FETCH_OVERLAP
}
let
(
:page_1_boundary
)
{
page_1
.
last
.
updated_at
+
NotesFinder
::
FETCH_OVERLAP
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
do
freeze_tim
e
do
example
.
run
example
.
run
end
end
end
end
...
...
spec/migrations/20190924152703_migrate_issue_trackers_data_spec.rb
View file @
18aec09e
...
@@ -52,7 +52,7 @@ RSpec.describe MigrateIssueTrackersData do
...
@@ -52,7 +52,7 @@ RSpec.describe MigrateIssueTrackersData do
it
'schedules background migrations at correct time'
do
it
'schedules background migrations at correct time'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
3
.
minutes
,
jira_service
.
id
,
bugzilla_service
.
id
)
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
3
.
minutes
,
jira_service
.
id
,
bugzilla_service
.
id
)
...
...
spec/migrations/20200122123016_backfill_project_settings_spec.rb
View file @
18aec09e
...
@@ -19,7 +19,7 @@ RSpec.describe BackfillProjectSettings, :sidekiq, schema: 20200114113341 do
...
@@ -19,7 +19,7 @@ RSpec.describe BackfillProjectSettings, :sidekiq, schema: 20200114113341 do
it
'schedules BackfillProjectSettings background jobs'
do
it
'schedules BackfillProjectSettings background jobs'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
1
,
2
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
1
,
2
)
...
...
spec/migrations/20200130145430_reschedule_migrate_issue_trackers_data_spec.rb
View file @
18aec09e
...
@@ -53,7 +53,7 @@ RSpec.describe RescheduleMigrateIssueTrackersData do
...
@@ -53,7 +53,7 @@ RSpec.describe RescheduleMigrateIssueTrackersData do
describe
"#up"
do
describe
"#up"
do
it
'schedules background migrations at correct time'
do
it
'schedules background migrations at correct time'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
3
.
minutes
,
jira_service
.
id
,
bugzilla_service
.
id
)
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
3
.
minutes
,
jira_service
.
id
,
bugzilla_service
.
id
)
...
...
spec/migrations/20200406102120_backfill_deployment_clusters_from_deployments_spec.rb
View file @
18aec09e
...
@@ -27,7 +27,7 @@ RSpec.describe BackfillDeploymentClustersFromDeployments, :migration, :sidekiq,
...
@@ -27,7 +27,7 @@ RSpec.describe BackfillDeploymentClustersFromDeployments, :migration, :sidekiq,
batch_2_end
=
create_deployment
(
**
deployment_data
)
batch_2_end
=
create_deployment
(
**
deployment_data
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
# batch 1
# batch 1
...
...
spec/migrations/20200703125016_backfill_namespace_settings_spec.rb
View file @
18aec09e
...
@@ -17,7 +17,7 @@ RSpec.describe BackfillNamespaceSettings, :sidekiq, schema: 20200703124823 do
...
@@ -17,7 +17,7 @@ RSpec.describe BackfillNamespaceSettings, :sidekiq, schema: 20200703124823 do
it
'schedules BackfillNamespaceSettings background jobs'
do
it
'schedules BackfillNamespaceSettings background jobs'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
1
,
2
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
1
,
2
)
...
...
spec/migrations/backfill_imported_snippet_repositories_spec.rb
View file @
18aec09e
...
@@ -30,7 +30,7 @@ RSpec.describe BackfillImportedSnippetRepositories do
...
@@ -30,7 +30,7 @@ RSpec.describe BackfillImportedSnippetRepositories do
create_snippet
(
10
)
create_snippet
(
10
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
described_class
::
MIGRATION
)
expect
(
described_class
::
MIGRATION
)
...
...
spec/migrations/backfill_snippet_repositories_spec.rb
View file @
18aec09e
...
@@ -28,7 +28,7 @@ RSpec.describe BackfillSnippetRepositories do
...
@@ -28,7 +28,7 @@ RSpec.describe BackfillSnippetRepositories do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
described_class
::
MIGRATION
)
expect
(
described_class
::
MIGRATION
)
...
...
spec/migrations/enqueue_reset_merge_status_second_run_spec.rb
View file @
18aec09e
...
@@ -33,7 +33,7 @@ RSpec.describe EnqueueResetMergeStatusSecondRun do
...
@@ -33,7 +33,7 @@ RSpec.describe EnqueueResetMergeStatusSecondRun do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
described_class
::
MIGRATION
)
expect
(
described_class
::
MIGRATION
)
...
...
spec/migrations/enqueue_reset_merge_status_spec.rb
View file @
18aec09e
...
@@ -33,7 +33,7 @@ RSpec.describe EnqueueResetMergeStatus do
...
@@ -33,7 +33,7 @@ RSpec.describe EnqueueResetMergeStatus do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
described_class
::
MIGRATION
)
expect
(
described_class
::
MIGRATION
)
...
...
spec/migrations/fix_projects_without_project_feature_spec.rb
View file @
18aec09e
...
@@ -20,7 +20,7 @@ RSpec.describe FixProjectsWithoutProjectFeature do
...
@@ -20,7 +20,7 @@ RSpec.describe FixProjectsWithoutProjectFeature do
around
do
|
example
|
around
do
|
example
|
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
example
.
call
example
.
call
end
end
end
end
...
...
spec/migrations/fix_projects_without_prometheus_services_spec.rb
View file @
18aec09e
...
@@ -20,7 +20,7 @@ RSpec.describe FixProjectsWithoutPrometheusService, :migration do
...
@@ -20,7 +20,7 @@ RSpec.describe FixProjectsWithoutPrometheusService, :migration do
around
do
|
example
|
around
do
|
example
|
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
example
.
call
example
.
call
end
end
end
end
...
...
spec/migrations/fix_wrong_pages_access_level_spec.rb
View file @
18aec09e
...
@@ -29,7 +29,7 @@ RSpec.describe FixWrongPagesAccessLevel, :sidekiq_might_not_need_inline, schema:
...
@@ -29,7 +29,7 @@ RSpec.describe FixWrongPagesAccessLevel, :sidekiq_might_not_need_inline, schema:
it
'correctly schedules background migrations'
do
it
'correctly schedules background migrations'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
first_id
=
create_project_feature
(
"project1"
,
project_class
::
PRIVATE
,
feature_class
::
PRIVATE
).
id
first_id
=
create_project_feature
(
"project1"
,
project_class
::
PRIVATE
,
feature_class
::
PRIVATE
).
id
last_id
=
create_project_feature
(
"project2"
,
project_class
::
PRIVATE
,
feature_class
::
PUBLIC
).
id
last_id
=
create_project_feature
(
"project2"
,
project_class
::
PRIVATE
,
feature_class
::
PUBLIC
).
id
...
...
spec/migrations/migrate_discussion_id_on_promoted_epics_spec.rb
View file @
18aec09e
...
@@ -53,7 +53,7 @@ RSpec.describe MigrateDiscussionIdOnPromotedEpics do
...
@@ -53,7 +53,7 @@ RSpec.describe MigrateDiscussionIdOnPromotedEpics do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
%w(id1 id2)
)
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
%w(id1 id2)
)
...
@@ -69,7 +69,7 @@ RSpec.describe MigrateDiscussionIdOnPromotedEpics do
...
@@ -69,7 +69,7 @@ RSpec.describe MigrateDiscussionIdOnPromotedEpics do
create_note
(
create_epic
,
'id3'
)
create_note
(
create_epic
,
'id3'
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
%w(id1)
)
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
%w(id1)
)
...
...
spec/migrations/schedule_calculate_wiki_sizes_spec.rb
View file @
18aec09e
...
@@ -21,7 +21,7 @@ RSpec.describe ScheduleCalculateWikiSizes do
...
@@ -21,7 +21,7 @@ RSpec.describe ScheduleCalculateWikiSizes do
let!
(
:project_statistic3
)
{
project_statistics
.
create!
(
project_id:
project3
.
id
,
namespace_id:
namespace
.
id
,
wiki_size:
nil
)
}
let!
(
:project_statistic3
)
{
project_statistics
.
create!
(
project_id:
project3
.
id
,
namespace_id:
namespace
.
id
,
wiki_size:
nil
)
}
it
'schedules a background migration'
do
it
'schedules a background migration'
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
5
.
minutes
,
project_statistic2
.
id
,
project_statistic3
.
id
)
expect
(
migration_name
).
to
be_scheduled_delayed_migration
(
5
.
minutes
,
project_statistic2
.
id
,
project_statistic3
.
id
)
...
@@ -49,7 +49,7 @@ RSpec.describe ScheduleCalculateWikiSizes do
...
@@ -49,7 +49,7 @@ RSpec.describe ScheduleCalculateWikiSizes do
it
'does not schedule a background migration'
do
it
'does not schedule a background migration'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
0
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
0
...
...
spec/migrations/schedule_fill_valid_time_for_pages_domain_certificates_spec.rb
View file @
18aec09e
...
@@ -22,7 +22,7 @@ RSpec.describe ScheduleFillValidTimeForPagesDomainCertificates do
...
@@ -22,7 +22,7 @@ RSpec.describe ScheduleFillValidTimeForPagesDomainCertificates do
it
'correctly schedules background migrations'
do
it
'correctly schedules background migrations'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
first_id
=
domains_table
.
find_by_domain
(
"domain3.example.com"
).
id
first_id
=
domains_table
.
find_by_domain
(
"domain3.example.com"
).
id
...
...
spec/migrations/schedule_migrate_security_scans_spec.rb
View file @
18aec09e
...
@@ -40,7 +40,7 @@ RSpec.describe ScheduleMigrateSecurityScans, :sidekiq do
...
@@ -40,7 +40,7 @@ RSpec.describe ScheduleMigrateSecurityScans, :sidekiq do
it
'schedules migration of security scans'
do
it
'schedules migration of security scans'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migration
.
up
migration
.
up
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
5
.
minutes
,
job_artifact_1
.
id
,
job_artifact_1
.
id
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
5
.
minutes
,
job_artifact_1
.
id
,
job_artifact_1
.
id
)
...
@@ -57,7 +57,7 @@ RSpec.describe ScheduleMigrateSecurityScans, :sidekiq do
...
@@ -57,7 +57,7 @@ RSpec.describe ScheduleMigrateSecurityScans, :sidekiq do
it
'schedules migration of security scans'
do
it
'schedules migration of security scans'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migration
.
up
migration
.
up
expect
(
BackgroundMigrationWorker
.
jobs
).
to
be_empty
expect
(
BackgroundMigrationWorker
.
jobs
).
to
be_empty
...
...
spec/migrations/schedule_pages_metadata_migration_spec.rb
View file @
18aec09e
...
@@ -17,7 +17,7 @@ RSpec.describe SchedulePagesMetadataMigration do
...
@@ -17,7 +17,7 @@ RSpec.describe SchedulePagesMetadataMigration do
it
'schedules pages metadata migration'
do
it
'schedules pages metadata migration'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
111
,
111
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
2
.
minutes
,
111
,
111
)
...
...
spec/migrations/schedule_populate_merge_request_assignees_table_spec.rb
View file @
18aec09e
...
@@ -31,7 +31,7 @@ RSpec.describe SchedulePopulateMergeRequestAssigneesTable do
...
@@ -31,7 +31,7 @@ RSpec.describe SchedulePopulateMergeRequestAssigneesTable do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
described_class
::
MIGRATION
)
expect
(
described_class
::
MIGRATION
)
...
...
spec/migrations/schedule_populate_personal_snippet_statistics_spec.rb
View file @
18aec09e
...
@@ -38,7 +38,7 @@ RSpec.describe SchedulePopulatePersonalSnippetStatistics do
...
@@ -38,7 +38,7 @@ RSpec.describe SchedulePopulatePersonalSnippetStatistics do
stub_const
(
"
#{
described_class
}
::BATCH_SIZE"
,
4
)
stub_const
(
"
#{
described_class
}
::BATCH_SIZE"
,
4
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
aggregate_failures
do
aggregate_failures
do
...
...
spec/migrations/schedule_populate_project_snippet_statistics_spec.rb
View file @
18aec09e
...
@@ -43,7 +43,7 @@ RSpec.describe SchedulePopulateProjectSnippetStatistics do
...
@@ -43,7 +43,7 @@ RSpec.describe SchedulePopulateProjectSnippetStatistics do
stub_const
(
"
#{
described_class
}
::BATCH_SIZE"
,
4
)
stub_const
(
"
#{
described_class
}
::BATCH_SIZE"
,
4
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
aggregate_failures
do
aggregate_failures
do
...
...
spec/migrations/schedule_populate_user_highest_roles_table_spec.rb
View file @
18aec09e
...
@@ -32,7 +32,7 @@ RSpec.describe SchedulePopulateUserHighestRolesTable do
...
@@ -32,7 +32,7 @@ RSpec.describe SchedulePopulateUserHighestRolesTable do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
5
.
minutes
,
1
,
4
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_delayed_migration
(
5
.
minutes
,
1
,
4
)
...
...
spec/migrations/schedule_recalculate_project_authorizations_second_run_spec.rb
View file @
18aec09e
...
@@ -16,7 +16,7 @@ RSpec.describe ScheduleRecalculateProjectAuthorizationsSecondRun do
...
@@ -16,7 +16,7 @@ RSpec.describe ScheduleRecalculateProjectAuthorizationsSecondRun do
it
'schedules background migration'
do
it
'schedules background migration'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
...
...
spec/migrations/schedule_recalculate_project_authorizations_spec.rb
View file @
18aec09e
...
@@ -26,7 +26,7 @@ RSpec.describe ScheduleRecalculateProjectAuthorizations do
...
@@ -26,7 +26,7 @@ RSpec.describe ScheduleRecalculateProjectAuthorizations do
it
'schedules background migration'
do
it
'schedules background migration'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
...
@@ -45,7 +45,7 @@ RSpec.describe ScheduleRecalculateProjectAuthorizations do
...
@@ -45,7 +45,7 @@ RSpec.describe ScheduleRecalculateProjectAuthorizations do
access_level:
30
)
access_level:
30
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
...
...
spec/migrations/schedule_recalculate_project_authorizations_third_run_spec.rb
View file @
18aec09e
...
@@ -16,7 +16,7 @@ RSpec.describe ScheduleRecalculateProjectAuthorizationsThirdRun do
...
@@ -16,7 +16,7 @@ RSpec.describe ScheduleRecalculateProjectAuthorizationsThirdRun do
it
'schedules background migration'
do
it
'schedules background migration'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
...
...
spec/migrations/schedule_sync_issuables_state_id_spec.rb
View file @
18aec09e
...
@@ -20,7 +20,7 @@ RSpec.describe ScheduleSyncIssuablesStateId do
...
@@ -20,7 +20,7 @@ RSpec.describe ScheduleSyncIssuablesStateId do
it
'correctly schedules issuable sync background migration'
do
it
'correctly schedules issuable sync background migration'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
migration
).
to
be_scheduled_delayed_migration
(
120
.
seconds
,
resource_1
.
id
,
resource_2
.
id
)
expect
(
migration
).
to
be_scheduled_delayed_migration
(
120
.
seconds
,
resource_1
.
id
,
resource_2
.
id
)
...
...
spec/migrations/schedule_sync_issuables_state_id_where_nil_spec.rb
View file @
18aec09e
...
@@ -20,7 +20,7 @@ RSpec.describe ScheduleSyncIssuablesStateIdWhereNil do
...
@@ -20,7 +20,7 @@ RSpec.describe ScheduleSyncIssuablesStateIdWhereNil do
it
'correctly schedules issuable sync background migration'
do
it
'correctly schedules issuable sync background migration'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
migration
).
to
be_scheduled_delayed_migration
(
120
.
seconds
,
resource_1
.
id
,
resource_3
.
id
)
expect
(
migration
).
to
be_scheduled_delayed_migration
(
120
.
seconds
,
resource_1
.
id
,
resource_3
.
id
)
...
...
spec/migrations/schedule_update_existing_subgroup_to_match_visibility_level_of_parent_spec.rb
View file @
18aec09e
...
@@ -14,7 +14,7 @@ RSpec.describe ScheduleUpdateExistingSubgroupToMatchVisibilityLevelOfParent do
...
@@ -14,7 +14,7 @@ RSpec.describe ScheduleUpdateExistingSubgroupToMatchVisibilityLevelOfParent do
create_namespace
(
'child'
,
Gitlab
::
VisibilityLevel
::
PUBLIC
,
parent_id:
parent
.
id
)
create_namespace
(
'child'
,
Gitlab
::
VisibilityLevel
::
PUBLIC
,
parent_id:
parent
.
id
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
1
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
1
)
...
@@ -30,7 +30,7 @@ RSpec.describe ScheduleUpdateExistingSubgroupToMatchVisibilityLevelOfParent do
...
@@ -30,7 +30,7 @@ RSpec.describe ScheduleUpdateExistingSubgroupToMatchVisibilityLevelOfParent do
create_namespace
(
'child'
,
Gitlab
::
VisibilityLevel
::
PUBLIC
,
parent_id:
middle_group
.
id
)
create_namespace
(
'child'
,
Gitlab
::
VisibilityLevel
::
PUBLIC
,
parent_id:
middle_group
.
id
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
1
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
1
)
...
@@ -47,7 +47,7 @@ RSpec.describe ScheduleUpdateExistingSubgroupToMatchVisibilityLevelOfParent do
...
@@ -47,7 +47,7 @@ RSpec.describe ScheduleUpdateExistingSubgroupToMatchVisibilityLevelOfParent do
create_namespace
(
'child'
,
Gitlab
::
VisibilityLevel
::
PUBLIC
,
parent_id:
middle_group
.
id
)
create_namespace
(
'child'
,
Gitlab
::
VisibilityLevel
::
PUBLIC
,
parent_id:
middle_group
.
id
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
1
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
1
)
...
@@ -66,7 +66,7 @@ RSpec.describe ScheduleUpdateExistingSubgroupToMatchVisibilityLevelOfParent do
...
@@ -66,7 +66,7 @@ RSpec.describe ScheduleUpdateExistingSubgroupToMatchVisibilityLevelOfParent do
create_namespace
(
'child'
,
Gitlab
::
VisibilityLevel
::
PUBLIC
,
parent_id:
middle_group
.
id
)
create_namespace
(
'child'
,
Gitlab
::
VisibilityLevel
::
PUBLIC
,
parent_id:
middle_group
.
id
)
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
migrate!
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
...
...
spec/models/board_group_recent_visit_spec.rb
View file @
18aec09e
...
@@ -28,7 +28,7 @@ RSpec.describe BoardGroupRecentVisit do
...
@@ -28,7 +28,7 @@ RSpec.describe BoardGroupRecentVisit do
let!
(
:visit
)
{
create
:board_group_recent_visit
,
group:
board
.
group
,
board:
board
,
user:
user
,
updated_at:
7
.
days
.
ago
}
let!
(
:visit
)
{
create
:board_group_recent_visit
,
group:
board
.
group
,
board:
board
,
user:
user
,
updated_at:
7
.
days
.
ago
}
it
'updates the timestamp'
do
it
'updates the timestamp'
do
Timecop
.
freez
e
do
freeze_tim
e
do
described_class
.
visited!
(
user
,
board
)
described_class
.
visited!
(
user
,
board
)
expect
(
described_class
.
count
).
to
eq
1
expect
(
described_class
.
count
).
to
eq
1
...
...
spec/models/board_project_recent_visit_spec.rb
View file @
18aec09e
...
@@ -28,7 +28,7 @@ RSpec.describe BoardProjectRecentVisit do
...
@@ -28,7 +28,7 @@ RSpec.describe BoardProjectRecentVisit do
let!
(
:visit
)
{
create
:board_project_recent_visit
,
project:
board
.
project
,
board:
board
,
user:
user
,
updated_at:
7
.
days
.
ago
}
let!
(
:visit
)
{
create
:board_project_recent_visit
,
project:
board
.
project
,
board:
board
,
user:
user
,
updated_at:
7
.
days
.
ago
}
it
'updates the timestamp'
do
it
'updates the timestamp'
do
Timecop
.
freez
e
do
freeze_tim
e
do
described_class
.
visited!
(
user
,
board
)
described_class
.
visited!
(
user
,
board
)
expect
(
described_class
.
count
).
to
eq
1
expect
(
described_class
.
count
).
to
eq
1
...
...
spec/models/ci/build_spec.rb
View file @
18aec09e
...
@@ -448,7 +448,7 @@ RSpec.describe Ci::Build do
...
@@ -448,7 +448,7 @@ RSpec.describe Ci::Build do
end
end
it
'schedules BuildScheduleWorker at the right time'
do
it
'schedules BuildScheduleWorker at the right time'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
Ci
::
BuildScheduleWorker
)
expect
(
Ci
::
BuildScheduleWorker
)
.
to
receive
(
:perform_at
).
with
(
be_like_time
(
1
.
minute
.
since
),
build
.
id
)
.
to
receive
(
:perform_at
).
with
(
be_like_time
(
1
.
minute
.
since
),
build
.
id
)
...
@@ -496,7 +496,7 @@ RSpec.describe Ci::Build do
...
@@ -496,7 +496,7 @@ RSpec.describe Ci::Build do
let
(
:option
)
{
{
start_in:
'1 day'
}
}
let
(
:option
)
{
{
start_in:
'1 day'
}
}
it
'returns date after 1 day'
do
it
'returns date after 1 day'
do
Timecop
.
freez
e
do
freeze_tim
e
do
is_expected
.
to
eq
(
1
.
day
.
since
)
is_expected
.
to
eq
(
1
.
day
.
since
)
end
end
end
end
...
@@ -506,7 +506,7 @@ RSpec.describe Ci::Build do
...
@@ -506,7 +506,7 @@ RSpec.describe Ci::Build do
let
(
:option
)
{
{
start_in:
'1 week'
}
}
let
(
:option
)
{
{
start_in:
'1 week'
}
}
it
'returns date after 1 week'
do
it
'returns date after 1 week'
do
Timecop
.
freez
e
do
freeze_tim
e
do
is_expected
.
to
eq
(
1
.
week
.
since
)
is_expected
.
to
eq
(
1
.
week
.
since
)
end
end
end
end
...
@@ -4087,7 +4087,7 @@ RSpec.describe Ci::Build do
...
@@ -4087,7 +4087,7 @@ RSpec.describe Ci::Build do
let
(
:path
)
{
'other_artifacts_0.1.2/another-subdirectory/banana_sample.gif'
}
let
(
:path
)
{
'other_artifacts_0.1.2/another-subdirectory/banana_sample.gif'
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
before
do
before
do
...
...
spec/models/clusters/applications/prometheus_spec.rb
View file @
18aec09e
...
@@ -46,7 +46,7 @@ RSpec.describe Clusters::Applications::Prometheus do
...
@@ -46,7 +46,7 @@ RSpec.describe Clusters::Applications::Prometheus do
subject
{
create
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
}
subject
{
create
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
}
it
'sets last_update_started_at to now'
do
it
'sets last_update_started_at to now'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
{
subject
.
make_updating
}.
to
change
{
subject
.
reload
.
last_update_started_at
}.
to
be_within
(
1
.
second
).
of
(
Time
.
current
)
expect
{
subject
.
make_updating
}.
to
change
{
subject
.
reload
.
last_update_started_at
}.
to
be_within
(
1
.
second
).
of
(
Time
.
current
)
end
end
end
end
...
@@ -353,7 +353,7 @@ RSpec.describe Clusters::Applications::Prometheus do
...
@@ -353,7 +353,7 @@ RSpec.describe Clusters::Applications::Prometheus do
let
(
:timestamp
)
{
Time
.
current
-
5
.
minutes
}
let
(
:timestamp
)
{
Time
.
current
-
5
.
minutes
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
before
do
before
do
...
...
spec/models/concerns/prometheus_adapter_spec.rb
View file @
18aec09e
...
@@ -25,7 +25,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
...
@@ -25,7 +25,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
let
(
:validation_respone
)
{
{
data:
{
valid:
true
}
}
}
let
(
:validation_respone
)
{
{
data:
{
valid:
true
}
}
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'with valid data'
do
context
'with valid data'
do
...
@@ -45,7 +45,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
...
@@ -45,7 +45,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
let
(
:environment
)
{
build_stubbed
(
:environment
,
slug:
'env-slug'
)
}
let
(
:environment
)
{
build_stubbed
(
:environment
,
slug:
'env-slug'
)
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'with valid data'
do
context
'with valid data'
do
...
@@ -85,7 +85,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
...
@@ -85,7 +85,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
let
(
:deployment_query
)
{
Gitlab
::
Prometheus
::
Queries
::
DeploymentQuery
}
let
(
:deployment_query
)
{
Gitlab
::
Prometheus
::
Queries
::
DeploymentQuery
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'with valid data'
do
context
'with valid data'
do
...
@@ -107,7 +107,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
...
@@ -107,7 +107,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
let
(
:time_window
)
{
[
1552642245.067
,
1552642095.831
]
}
let
(
:time_window
)
{
[
1552642245.067
,
1552642095.831
]
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'with valid data'
do
context
'with valid data'
do
...
@@ -137,7 +137,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
...
@@ -137,7 +137,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
end
end
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'when service is inactive'
do
context
'when service is inactive'
do
...
...
spec/models/deployment_spec.rb
View file @
18aec09e
...
@@ -99,7 +99,7 @@ RSpec.describe Deployment do
...
@@ -99,7 +99,7 @@ RSpec.describe Deployment do
end
end
it
'starts running'
do
it
'starts running'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
deployment
).
to
be_running
expect
(
deployment
).
to
be_running
expect
(
deployment
.
finished_at
).
to
be_nil
expect
(
deployment
.
finished_at
).
to
be_nil
end
end
...
@@ -110,7 +110,7 @@ RSpec.describe Deployment do
...
@@ -110,7 +110,7 @@ RSpec.describe Deployment do
let
(
:deployment
)
{
create
(
:deployment
,
:running
)
}
let
(
:deployment
)
{
create
(
:deployment
,
:running
)
}
it
'has correct status'
do
it
'has correct status'
do
Timecop
.
freez
e
do
freeze_tim
e
do
deployment
.
succeed!
deployment
.
succeed!
expect
(
deployment
).
to
be_success
expect
(
deployment
).
to
be_success
...
@@ -137,7 +137,7 @@ RSpec.describe Deployment do
...
@@ -137,7 +137,7 @@ RSpec.describe Deployment do
let
(
:deployment
)
{
create
(
:deployment
,
:running
)
}
let
(
:deployment
)
{
create
(
:deployment
,
:running
)
}
it
'has correct status'
do
it
'has correct status'
do
Timecop
.
freez
e
do
freeze_tim
e
do
deployment
.
drop!
deployment
.
drop!
expect
(
deployment
).
to
be_failed
expect
(
deployment
).
to
be_failed
...
@@ -157,7 +157,7 @@ RSpec.describe Deployment do
...
@@ -157,7 +157,7 @@ RSpec.describe Deployment do
let
(
:deployment
)
{
create
(
:deployment
,
:running
)
}
let
(
:deployment
)
{
create
(
:deployment
,
:running
)
}
it
'has correct status'
do
it
'has correct status'
do
Timecop
.
freez
e
do
freeze_tim
e
do
deployment
.
cancel!
deployment
.
cancel!
expect
(
deployment
).
to
be_canceled
expect
(
deployment
).
to
be_canceled
...
@@ -584,7 +584,7 @@ RSpec.describe Deployment do
...
@@ -584,7 +584,7 @@ RSpec.describe Deployment do
end
end
it
'updates finished_at when transitioning to a finished status'
do
it
'updates finished_at when transitioning to a finished status'
do
Timecop
.
freez
e
do
freeze_tim
e
do
deploy
.
update_status
(
'success'
)
deploy
.
update_status
(
'success'
)
expect
(
deploy
.
read_attribute
(
:finished_at
)).
to
eq
(
Time
.
current
)
expect
(
deploy
.
read_attribute
(
:finished_at
)).
to
eq
(
Time
.
current
)
...
...
spec/models/environment_spec.rb
View file @
18aec09e
...
@@ -1222,7 +1222,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
...
@@ -1222,7 +1222,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
let
(
:environment
)
{
build
(
:environment
,
:will_auto_stop
)
}
let
(
:environment
)
{
build
(
:environment
,
:will_auto_stop
)
}
it
'returns when it will expire'
do
it
'returns when it will expire'
do
Timecop
.
freez
e
{
is_expected
.
to
eq
(
1
.
day
.
to_i
)
}
freeze_tim
e
{
is_expected
.
to
eq
(
1
.
day
.
to_i
)
}
end
end
end
end
...
@@ -1248,7 +1248,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
...
@@ -1248,7 +1248,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
end
end
with_them
do
with_them
do
it
'sets correct auto_stop_in'
do
it
'sets correct auto_stop_in'
do
Timecop
.
freez
e
do
freeze_tim
e
do
if
expected_result
.
is_a?
(
Integer
)
||
expected_result
.
nil?
if
expected_result
.
is_a?
(
Integer
)
||
expected_result
.
nil?
subject
subject
...
...
spec/models/metrics/dashboard/annotation_spec.rb
View file @
18aec09e
...
@@ -100,7 +100,7 @@ RSpec.describe Metrics::Dashboard::Annotation do
...
@@ -100,7 +100,7 @@ RSpec.describe Metrics::Dashboard::Annotation do
describe
'#ending_before'
do
describe
'#ending_before'
do
it
'returns annotations only for appointed dashboard'
do
it
'returns annotations only for appointed dashboard'
do
Timecop
.
freez
e
do
freeze_tim
e
do
twelve_minutes_old_annotation
=
create
(
:metrics_dashboard_annotation
,
starting_at:
15
.
minutes
.
ago
,
ending_at:
12
.
minutes
.
ago
)
twelve_minutes_old_annotation
=
create
(
:metrics_dashboard_annotation
,
starting_at:
15
.
minutes
.
ago
,
ending_at:
12
.
minutes
.
ago
)
create
(
:metrics_dashboard_annotation
,
starting_at:
15
.
minutes
.
ago
,
ending_at:
11
.
minutes
.
ago
)
create
(
:metrics_dashboard_annotation
,
starting_at:
15
.
minutes
.
ago
,
ending_at:
11
.
minutes
.
ago
)
...
...
spec/models/remote_mirror_spec.rb
View file @
18aec09e
...
@@ -283,7 +283,7 @@ RSpec.describe RemoteMirror, :mailer do
...
@@ -283,7 +283,7 @@ RSpec.describe RemoteMirror, :mailer do
let
(
:remote_mirror
)
{
create
(
:project
,
:repository
,
:remote_mirror
).
remote_mirrors
.
first
}
let
(
:remote_mirror
)
{
create
(
:project
,
:repository
,
:remote_mirror
).
remote_mirrors
.
first
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'with remote mirroring disabled'
do
context
'with remote mirroring disabled'
do
...
@@ -397,7 +397,7 @@ RSpec.describe RemoteMirror, :mailer do
...
@@ -397,7 +397,7 @@ RSpec.describe RemoteMirror, :mailer do
let
(
:timestamp
)
{
Time
.
current
-
5
.
minutes
}
let
(
:timestamp
)
{
Time
.
current
-
5
.
minutes
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
before
do
before
do
...
...
spec/presenters/ci/build_presenter_spec.rb
View file @
18aec09e
...
@@ -228,7 +228,7 @@ RSpec.describe Ci::BuildPresenter do
...
@@ -228,7 +228,7 @@ RSpec.describe Ci::BuildPresenter do
let
(
:build
)
{
create
(
:ci_build
,
:scheduled
)
}
let
(
:build
)
{
create
(
:ci_build
,
:scheduled
)
}
it
'returns execution time'
do
it
'returns execution time'
do
Timecop
.
freez
e
do
freeze_tim
e
do
is_expected
.
to
be_like_time
(
60.0
)
is_expected
.
to
be_like_time
(
60.0
)
end
end
end
end
...
@@ -238,7 +238,7 @@ RSpec.describe Ci::BuildPresenter do
...
@@ -238,7 +238,7 @@ RSpec.describe Ci::BuildPresenter do
let
(
:build
)
{
create
(
:ci_build
,
:expired_scheduled
)
}
let
(
:build
)
{
create
(
:ci_build
,
:expired_scheduled
)
}
it
'returns execution time'
do
it
'returns execution time'
do
Timecop
.
freez
e
do
freeze_tim
e
do
is_expected
.
to
eq
(
0
)
is_expected
.
to
eq
(
0
)
end
end
end
end
...
@@ -249,7 +249,7 @@ RSpec.describe Ci::BuildPresenter do
...
@@ -249,7 +249,7 @@ RSpec.describe Ci::BuildPresenter do
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:build
)
{
create
(
:ci_build
)
}
it
'does not return execution time'
do
it
'does not return execution time'
do
Timecop
.
freez
e
do
freeze_tim
e
do
is_expected
.
to
be_falsy
is_expected
.
to
be_falsy
end
end
end
end
...
...
spec/requests/api/conan_packages_spec.rb
View file @
18aec09e
...
@@ -153,7 +153,7 @@ RSpec.describe API::ConanPackages do
...
@@ -153,7 +153,7 @@ RSpec.describe API::ConanPackages do
end
end
it
'token has valid validity time'
do
it
'token has valid validity time'
do
Timecop
.
freez
e
do
freeze_tim
e
do
subject
subject
payload
=
JSONWebToken
::
HMACToken
.
decode
(
payload
=
JSONWebToken
::
HMACToken
.
decode
(
...
...
spec/requests/api/internal/base_spec.rb
View file @
18aec09e
...
@@ -415,7 +415,7 @@ RSpec.describe API::Internal::Base do
...
@@ -415,7 +415,7 @@ RSpec.describe API::Internal::Base do
let
(
:env
)
{
{}
}
let
(
:env
)
{
{}
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
before
do
before
do
...
...
spec/serializers/analytics_build_entity_spec.rb
View file @
18aec09e
...
@@ -16,7 +16,7 @@ RSpec.describe AnalyticsBuildEntity do
...
@@ -16,7 +16,7 @@ RSpec.describe AnalyticsBuildEntity do
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
it
'contains the URL'
do
it
'contains the URL'
do
...
...
spec/services/clusters/applications/schedule_update_service_spec.rb
View file @
18aec09e
...
@@ -7,7 +7,7 @@ RSpec.describe Clusters::Applications::ScheduleUpdateService do
...
@@ -7,7 +7,7 @@ RSpec.describe Clusters::Applications::ScheduleUpdateService do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
context
'when application is able to be updated'
do
context
'when application is able to be updated'
do
...
...
spec/services/deployments/after_create_service_spec.rb
View file @
18aec09e
...
@@ -122,7 +122,7 @@ RSpec.describe Deployments::AfterCreateService do
...
@@ -122,7 +122,7 @@ RSpec.describe Deployments::AfterCreateService do
end
end
it
'renews auto stop at'
do
it
'renews auto stop at'
do
Timecop
.
freez
e
do
freeze_tim
e
do
environment
.
update!
(
auto_stop_at:
nil
)
environment
.
update!
(
auto_stop_at:
nil
)
expect
{
subject
.
execute
}
expect
{
subject
.
execute
}
...
...
spec/services/merge_requests/delete_non_latest_diffs_service_spec.rb
View file @
18aec09e
...
@@ -19,7 +19,7 @@ RSpec.describe MergeRequests::DeleteNonLatestDiffsService, :clean_gitlab_redis_s
...
@@ -19,7 +19,7 @@ RSpec.describe MergeRequests::DeleteNonLatestDiffsService, :clean_gitlab_redis_s
expect
(
diffs
.
count
).
to
eq
(
4
)
expect
(
diffs
.
count
).
to
eq
(
4
)
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
DeleteDiffFilesWorker
)
expect
(
DeleteDiffFilesWorker
)
.
to
receive
(
:bulk_perform_in
)
.
to
receive
(
:bulk_perform_in
)
.
with
(
5
.
minutes
,
[[
diffs
.
first
.
id
],
[
diffs
.
second
.
id
]])
.
with
(
5
.
minutes
,
[[
diffs
.
first
.
id
],
[
diffs
.
second
.
id
]])
...
...
spec/services/note_summary_spec.rb
View file @
18aec09e
...
@@ -23,7 +23,7 @@ RSpec.describe NoteSummary do
...
@@ -23,7 +23,7 @@ RSpec.describe NoteSummary do
describe
'#note'
do
describe
'#note'
do
it
'returns note hash'
do
it
'returns note hash'
do
Timecop
.
freez
e
do
freeze_tim
e
do
expect
(
create_note_summary
.
note
).
to
eq
(
noteable:
noteable
,
project:
project
,
author:
user
,
note:
'note'
,
expect
(
create_note_summary
.
note
).
to
eq
(
noteable:
noteable
,
project:
project
,
author:
user
,
note:
'note'
,
created_at:
Time
.
current
)
created_at:
Time
.
current
)
end
end
...
...
spec/services/projects/hashed_storage/base_attachment_service_spec.rb
View file @
18aec09e
...
@@ -30,7 +30,7 @@ RSpec.describe Projects::HashedStorage::BaseAttachmentService do
...
@@ -30,7 +30,7 @@ RSpec.describe Projects::HashedStorage::BaseAttachmentService do
target_path
=
Dir
.
mktmpdir
target_path
=
Dir
.
mktmpdir
expect
(
Dir
.
exist?
(
target_path
)).
to
be_truthy
expect
(
Dir
.
exist?
(
target_path
)).
to
be_truthy
Timecop
.
freez
e
do
freeze_tim
e
do
suffix
=
Time
.
current
.
utc
.
to_i
suffix
=
Time
.
current
.
utc
.
to_i
subject
.
send
(
:discard_path!
,
target_path
)
subject
.
send
(
:discard_path!
,
target_path
)
...
...
spec/services/releases/create_service_spec.rb
View file @
18aec09e
...
@@ -202,7 +202,7 @@ RSpec.describe Releases::CreateService do
...
@@ -202,7 +202,7 @@ RSpec.describe Releases::CreateService do
let
(
:last_release
)
{
project
.
releases
.
last
}
let
(
:last_release
)
{
project
.
releases
.
last
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freez
e
{
example
.
run
}
freeze_tim
e
{
example
.
run
}
end
end
subject
{
service
.
execute
}
subject
{
service
.
execute
}
...
...
spec/support/shared_examples/lib/gitlab/background_migration/mentions_migration_shared_examples.rb
View file @
18aec09e
...
@@ -63,7 +63,7 @@ RSpec.shared_examples 'schedules resource mentions migration' do |resource_class
...
@@ -63,7 +63,7 @@ RSpec.shared_examples 'schedules resource mentions migration' do |resource_class
it
'schedules background migrations'
do
it
'schedules background migrations'
do
Sidekiq
::
Testing
.
fake!
do
Sidekiq
::
Testing
.
fake!
do
Timecop
.
freez
e
do
freeze_tim
e
do
resource_count
=
is_for_notes
?
Note
.
count
:
resource_class
.
count
resource_count
=
is_for_notes
?
Note
.
count
:
resource_class
.
count
expect
(
resource_count
).
to
eq
5
expect
(
resource_count
).
to
eq
5
...
...
spec/support/shared_examples/models/throttled_touch_shared_examples.rb
View file @
18aec09e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
RSpec
.
shared_examples
'throttled touch'
do
RSpec
.
shared_examples
'throttled touch'
do
describe
'#touch'
do
describe
'#touch'
do
it
'updates the updated_at timestamp'
do
it
'updates the updated_at timestamp'
do
Timecop
.
freez
e
do
freeze_tim
e
do
subject
.
touch
subject
.
touch
expect
(
subject
.
updated_at
).
to
be_like_time
(
Time
.
zone
.
now
)
expect
(
subject
.
updated_at
).
to
be_like_time
(
Time
.
zone
.
now
)
end
end
...
...
spec/workers/cluster_update_app_worker_spec.rb
View file @
18aec09e
...
@@ -12,7 +12,7 @@ RSpec.describe ClusterUpdateAppWorker do
...
@@ -12,7 +12,7 @@ RSpec.describe ClusterUpdateAppWorker do
subject
{
described_class
.
new
}
subject
{
described_class
.
new
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freeze
(
Time
.
current
)
{
example
.
run
}
freeze_time
{
example
.
run
}
end
end
before
do
before
do
...
...
spec/workers/repository_update_remote_mirror_worker_spec.rb
View file @
18aec09e
...
@@ -9,7 +9,7 @@ RSpec.describe RepositoryUpdateRemoteMirrorWorker, :clean_gitlab_redis_shared_st
...
@@ -9,7 +9,7 @@ RSpec.describe RepositoryUpdateRemoteMirrorWorker, :clean_gitlab_redis_shared_st
let
(
:scheduled_time
)
{
Time
.
current
-
5
.
minutes
}
let
(
:scheduled_time
)
{
Time
.
current
-
5
.
minutes
}
around
do
|
example
|
around
do
|
example
|
Timecop
.
freeze
(
Time
.
current
)
{
example
.
run
}
freeze_time
{
example
.
run
}
end
end
def
expect_mirror_service_to_return
(
mirror
,
result
,
tries
=
0
)
def
expect_mirror_service_to_return
(
mirror
,
result
,
tries
=
0
)
...
...
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