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
ced4f681
Commit
ced4f681
authored
May 11, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Time.now => Time.current in controllers
- Update specs - CE and EE
parent
f8e8d27a
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
23 additions
and
23 deletions
+23
-23
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+1
-1
app/controllers/concerns/notes_actions.rb
app/controllers/concerns/notes_actions.rb
+1
-1
app/controllers/user_callouts_controller.rb
app/controllers/user_callouts_controller.rb
+1
-1
ee/app/controllers/ee/groups_controller.rb
ee/app/controllers/ee/groups_controller.rb
+1
-1
ee/app/controllers/ee/projects/mirrors_controller.rb
ee/app/controllers/ee/projects/mirrors_controller.rb
+1
-1
ee/app/controllers/projects/security/network_policies_controller.rb
...trollers/projects/security/network_policies_controller.rb
+1
-1
ee/spec/controllers/admin/application_settings_controller_spec.rb
...controllers/admin/application_settings_controller_spec.rb
+1
-1
ee/spec/controllers/analytics/cycle_analytics/stages_controller_spec.rb
...llers/analytics/cycle_analytics/stages_controller_spec.rb
+1
-1
ee/spec/controllers/groups/analytics/cycle_analytics/stages_controller_spec.rb
...roups/analytics/cycle_analytics/stages_controller_spec.rb
+1
-1
ee/spec/controllers/groups/contribution_analytics_controller_spec.rb
...trollers/groups/contribution_analytics_controller_spec.rb
+1
-1
ee/spec/controllers/groups/epics_controller_spec.rb
ee/spec/controllers/groups/epics_controller_spec.rb
+1
-1
ee/spec/controllers/operations_controller_spec.rb
ee/spec/controllers/operations_controller_spec.rb
+1
-1
ee/spec/controllers/projects/branches_controller_spec.rb
ee/spec/controllers/projects/branches_controller_spec.rb
+1
-1
ee/spec/controllers/projects/mirrors_controller_spec.rb
ee/spec/controllers/projects/mirrors_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
spec/controllers/admin/requests_profiles_controller_spec.rb
spec/controllers/admin/requests_profiles_controller_spec.rb
+3
-3
spec/controllers/admin/users_controller_spec.rb
spec/controllers/admin/users_controller_spec.rb
+1
-1
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+1
-1
spec/controllers/import/bitbucket_controller_spec.rb
spec/controllers/import/bitbucket_controller_spec.rb
+1
-1
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+1
-1
No files found.
app/controllers/admin/users_controller.rb
View file @
ced4f681
...
@@ -145,7 +145,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -145,7 +145,7 @@ class Admin::UsersController < Admin::ApplicationController
password_confirmation:
params
[
:user
][
:password_confirmation
]
password_confirmation:
params
[
:user
][
:password_confirmation
]
}
}
password_params
[
:password_expires_at
]
=
Time
.
now
unless
changing_own_password?
password_params
[
:password_expires_at
]
=
Time
.
current
unless
changing_own_password?
user_params_with_pass
.
merge!
(
password_params
)
user_params_with_pass
.
merge!
(
password_params
)
end
end
...
...
app/controllers/concerns/notes_actions.rb
View file @
ced4f681
...
@@ -13,7 +13,7 @@ module NotesActions
...
@@ -13,7 +13,7 @@ module NotesActions
end
end
def
index
def
index
current_fetched_at
=
Time
.
now
.
to_i
current_fetched_at
=
Time
.
current
.
to_i
notes_json
=
{
notes:
[],
last_fetched_at:
current_fetched_at
}
notes_json
=
{
notes:
[],
last_fetched_at:
current_fetched_at
}
...
...
app/controllers/user_callouts_controller.rb
View file @
ced4f681
...
@@ -5,7 +5,7 @@ class UserCalloutsController < ApplicationController
...
@@ -5,7 +5,7 @@ class UserCalloutsController < ApplicationController
callout
=
ensure_callout
callout
=
ensure_callout
if
callout
.
persisted?
if
callout
.
persisted?
callout
.
update
(
dismissed_at:
Time
.
now
)
callout
.
update
(
dismissed_at:
Time
.
current
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
{
head
:ok
}
format
.
json
{
head
:ok
}
end
end
...
...
ee/app/controllers/ee/groups_controller.rb
View file @
ced4f681
...
@@ -34,7 +34,7 @@ module EE
...
@@ -34,7 +34,7 @@ module EE
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
redirect_to
group_path
(
group
),
redirect_to
group_path
(
group
),
status: :found
,
status: :found
,
notice:
"'
#{
group
.
name
}
' has been scheduled for removal on
#{
permanent_deletion_date
(
Time
.
now
.
utc
)
}
."
notice:
"'
#{
group
.
name
}
' has been scheduled for removal on
#{
permanent_deletion_date
(
Time
.
current
.
utc
)
}
."
else
else
redirect_to
edit_group_path
(
group
),
status: :found
,
alert:
result
[
:message
]
redirect_to
edit_group_path
(
group
),
status: :found
,
alert:
result
[
:message
]
end
end
...
...
ee/app/controllers/ee/projects/mirrors_controller.rb
View file @
ced4f681
...
@@ -90,7 +90,7 @@ module EE
...
@@ -90,7 +90,7 @@ module EE
# If the known hosts data is being set, store details about who and when
# If the known hosts data is being set, store details about who and when
if
import_data
[
:ssh_known_hosts
].
present?
if
import_data
[
:ssh_known_hosts
].
present?
import_data
[
:ssh_known_hosts_verified_at
]
=
Time
.
now
import_data
[
:ssh_known_hosts_verified_at
]
=
Time
.
current
import_data
[
:ssh_known_hosts_verified_by_id
]
=
current_user
.
id
import_data
[
:ssh_known_hosts_verified_by_id
]
=
current_user
.
id
end
end
end
end
...
...
ee/app/controllers/projects/security/network_policies_controller.rb
View file @
ced4f681
...
@@ -18,7 +18,7 @@ module Projects
...
@@ -18,7 +18,7 @@ module Projects
:packet_flow
,
environment
.
deployment_namespace
,
:packet_flow
,
environment
.
deployment_namespace
,
params
[
:interval
]
||
"minute"
,
params
[
:interval
]
||
"minute"
,
(
Time
.
parse
(
params
[
:from
])
rescue
1
.
hour
.
ago
).
to_s
,
(
Time
.
parse
(
params
[
:from
])
rescue
1
.
hour
.
ago
).
to_s
,
(
Time
.
parse
(
params
[
:to
])
rescue
Time
.
now
).
to_s
(
Time
.
parse
(
params
[
:to
])
rescue
Time
.
current
).
to_s
)
)
respond_to
do
|
format
|
respond_to
do
|
format
|
...
...
ee/spec/controllers/admin/application_settings_controller_spec.rb
View file @
ced4f681
...
@@ -256,7 +256,7 @@ describe Admin::ApplicationSettingsController do
...
@@ -256,7 +256,7 @@ describe Admin::ApplicationSettingsController do
end
end
context
'when an admin user attempts a request'
do
context
'when an admin user attempts a request'
do
let_it_be
(
:yesterday
)
{
Time
.
now
.
utc
.
yesterday
.
to_date
}
let_it_be
(
:yesterday
)
{
Time
.
current
.
utc
.
yesterday
.
to_date
}
let_it_be
(
:max_count
)
{
15
}
let_it_be
(
:max_count
)
{
15
}
let_it_be
(
:current_count
)
{
10
}
let_it_be
(
:current_count
)
{
10
}
...
...
ee/spec/controllers/analytics/cycle_analytics/stages_controller_spec.rb
View file @
ced4f681
...
@@ -220,7 +220,7 @@ describe Analytics::CycleAnalytics::StagesController do
...
@@ -220,7 +220,7 @@ describe Analytics::CycleAnalytics::StagesController do
subject
{
get
:duration_chart
,
params:
params
}
subject
{
get
:duration_chart
,
params:
params
}
it
'matches the response schema'
do
it
'matches the response schema'
do
fake_result
=
[
double
(
MergeRequest
,
duration_in_seconds:
10
,
finished_at:
Time
.
now
)]
fake_result
=
[
double
(
MergeRequest
,
duration_in_seconds:
10
,
finished_at:
Time
.
current
)]
expect_any_instance_of
(
Gitlab
::
Analytics
::
CycleAnalytics
::
DataForDurationChart
).
to
receive
(
:load
).
and_return
(
fake_result
)
expect_any_instance_of
(
Gitlab
::
Analytics
::
CycleAnalytics
::
DataForDurationChart
).
to
receive
(
:load
).
and_return
(
fake_result
)
subject
subject
...
...
ee/spec/controllers/groups/analytics/cycle_analytics/stages_controller_spec.rb
View file @
ced4f681
...
@@ -220,7 +220,7 @@ describe Groups::Analytics::CycleAnalytics::StagesController do
...
@@ -220,7 +220,7 @@ describe Groups::Analytics::CycleAnalytics::StagesController do
subject
{
get
:duration_chart
,
params:
params
}
subject
{
get
:duration_chart
,
params:
params
}
it
'matches the response schema'
do
it
'matches the response schema'
do
fake_result
=
[
double
(
MergeRequest
,
duration_in_seconds:
10
,
finished_at:
Time
.
now
)]
fake_result
=
[
double
(
MergeRequest
,
duration_in_seconds:
10
,
finished_at:
Time
.
current
)]
expect_any_instance_of
(
Gitlab
::
Analytics
::
CycleAnalytics
::
DataForDurationChart
).
to
receive
(
:load
).
and_return
(
fake_result
)
expect_any_instance_of
(
Gitlab
::
Analytics
::
CycleAnalytics
::
DataForDurationChart
).
to
receive
(
:load
).
and_return
(
fake_result
)
subject
subject
...
...
ee/spec/controllers/groups/contribution_analytics_controller_spec.rb
View file @
ced4f681
...
@@ -19,7 +19,7 @@ describe Groups::ContributionAnalyticsController do
...
@@ -19,7 +19,7 @@ describe Groups::ContributionAnalyticsController do
action:
action
,
action:
action
,
target:
target
,
target:
target
,
author:
author
,
author:
author
,
created_at:
Time
.
now
)
created_at:
Time
.
current
)
end
end
def
create_push_event
(
author
,
project
)
def
create_push_event
(
author
,
project
)
...
...
ee/spec/controllers/groups/epics_controller_spec.rb
View file @
ced4f681
...
@@ -366,7 +366,7 @@ describe Groups::EpicsController do
...
@@ -366,7 +366,7 @@ describe Groups::EpicsController do
context
'when state_event param is reopen'
do
context
'when state_event param is reopen'
do
before
do
before
do
epic
.
update!
(
state:
'closed'
,
closed_at:
Time
.
now
,
closed_by:
user
)
epic
.
update!
(
state:
'closed'
,
closed_at:
Time
.
current
,
closed_by:
user
)
end
end
it
'allows epic to be reopened'
do
it
'allows epic to be reopened'
do
...
...
ee/spec/controllers/operations_controller_spec.rb
View file @
ced4f681
...
@@ -73,7 +73,7 @@ describe OperationsController do
...
@@ -73,7 +73,7 @@ describe OperationsController do
end
end
describe
'GET #list'
do
describe
'GET #list'
do
let
(
:now
)
{
Time
.
now
.
change
(
usec:
0
)
}
let
(
:now
)
{
Time
.
current
.
change
(
usec:
0
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit
)
{
project
.
commit
}
let!
(
:environment
)
{
create
(
:environment
,
name:
'production'
,
project:
project
)
}
let!
(
:environment
)
{
create
(
:environment
,
name:
'production'
,
project:
project
)
}
...
...
ee/spec/controllers/projects/branches_controller_spec.rb
View file @
ced4f681
...
@@ -18,7 +18,7 @@ describe Projects::BranchesController do
...
@@ -18,7 +18,7 @@ describe Projects::BranchesController do
render_views
render_views
before
do
before
do
create
(
:import_state
,
:mirror
,
:finished
,
project:
project
,
last_successful_update_at:
Time
.
now
)
create
(
:import_state
,
:mirror
,
:finished
,
project:
project
,
last_successful_update_at:
Time
.
current
)
allow
(
project
.
repository
).
to
receive
(
:diverged_from_upstream?
)
{
true
}
allow
(
project
.
repository
).
to
receive
(
:diverged_from_upstream?
)
{
true
}
end
end
...
...
ee/spec/controllers/projects/mirrors_controller_spec.rb
View file @
ced4f681
...
@@ -172,7 +172,7 @@ describe Projects::MirrorsController do
...
@@ -172,7 +172,7 @@ describe Projects::MirrorsController do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
import_data
=
project
.
reload_import_data
import_data
=
project
.
reload_import_data
expect
(
import_data
.
ssh_known_hosts_verified_at
).
to
be_within
(
1
.
minute
).
of
(
Time
.
now
)
expect
(
import_data
.
ssh_known_hosts_verified_at
).
to
be_within
(
1
.
minute
).
of
(
Time
.
current
)
expect
(
import_data
.
ssh_known_hosts_verified_by
).
to
eq
(
project
.
owner
)
expect
(
import_data
.
ssh_known_hosts_verified_by
).
to
eq
(
project
.
owner
)
end
end
...
...
ee/spec/controllers/projects/security/network_policies_controller_spec.rb
View file @
ced4f681
...
@@ -40,7 +40,7 @@ describe Projects::Security::NetworkPoliciesController do
...
@@ -40,7 +40,7 @@ describe Projects::Security::NetworkPoliciesController do
Timecop
.
freeze
do
Timecop
.
freeze
do
expect
(
adapter
).
to
(
expect
(
adapter
).
to
(
receive
(
:query
)
receive
(
:query
)
.
with
(
:packet_flow
,
kubernetes_namespace
,
"minute"
,
1
.
hour
.
ago
.
to_s
,
Time
.
now
.
to_s
)
.
with
(
:packet_flow
,
kubernetes_namespace
,
"minute"
,
1
.
hour
.
ago
.
to_s
,
Time
.
current
.
to_s
)
.
and_return
({
success:
true
,
data:
{
ops_rate:
[[
Time
.
at
(
0
).
to_i
,
10
]],
ops_total:
10
}
})
.
and_return
({
success:
true
,
data:
{
ops_rate:
[[
Time
.
at
(
0
).
to_i
,
10
]],
ops_total:
10
}
})
)
)
subject
subject
...
@@ -81,7 +81,7 @@ describe Projects::Security::NetworkPoliciesController do
...
@@ -81,7 +81,7 @@ describe Projects::Security::NetworkPoliciesController do
Timecop
.
freeze
do
Timecop
.
freeze
do
expect
(
adapter
).
to
(
expect
(
adapter
).
to
(
receive
(
:query
)
receive
(
:query
)
.
with
(
:packet_flow
,
kubernetes_namespace
,
"minute"
,
1
.
hour
.
ago
.
to_s
,
Time
.
now
.
to_s
)
.
with
(
:packet_flow
,
kubernetes_namespace
,
"minute"
,
1
.
hour
.
ago
.
to_s
,
Time
.
current
.
to_s
)
.
and_return
({
success:
true
,
data:
{}
})
.
and_return
({
success:
true
,
data:
{}
})
)
)
subject
subject
...
...
spec/controllers/admin/requests_profiles_controller_spec.rb
View file @
ced4f681
...
@@ -27,7 +27,7 @@ describe Admin::RequestsProfilesController do
...
@@ -27,7 +27,7 @@ describe Admin::RequestsProfilesController do
end
end
context
'when loading HTML profile'
do
context
'when loading HTML profile'
do
let
(
:basename
)
{
"profile_
#{
Time
.
now
.
to_i
}
_execution.html"
}
let
(
:basename
)
{
"profile_
#{
Time
.
current
.
to_i
}
_execution.html"
}
let
(
:sample_data
)
do
let
(
:sample_data
)
do
'<html> <body> <h1>Heading</h1> <p>paragraph.</p> </body> </html>'
'<html> <body> <h1>Heading</h1> <p>paragraph.</p> </body> </html>'
...
@@ -42,7 +42,7 @@ describe Admin::RequestsProfilesController do
...
@@ -42,7 +42,7 @@ describe Admin::RequestsProfilesController do
end
end
context
'when loading TXT profile'
do
context
'when loading TXT profile'
do
let
(
:basename
)
{
"profile_
#{
Time
.
now
.
to_i
}
_memory.txt"
}
let
(
:basename
)
{
"profile_
#{
Time
.
current
.
to_i
}
_memory.txt"
}
let
(
:sample_data
)
do
let
(
:sample_data
)
do
<<~
TXT
<<~
TXT
...
@@ -60,7 +60,7 @@ describe Admin::RequestsProfilesController do
...
@@ -60,7 +60,7 @@ describe Admin::RequestsProfilesController do
end
end
context
'when loading PDF profile'
do
context
'when loading PDF profile'
do
let
(
:basename
)
{
"profile_
#{
Time
.
now
.
to_i
}
_anything.pdf"
}
let
(
:basename
)
{
"profile_
#{
Time
.
current
.
to_i
}
_anything.pdf"
}
let
(
:sample_data
)
{
'mocked pdf content'
}
let
(
:sample_data
)
{
'mocked pdf content'
}
...
...
spec/controllers/admin/users_controller_spec.rb
View file @
ced4f681
...
@@ -296,7 +296,7 @@ describe Admin::UsersController do
...
@@ -296,7 +296,7 @@ describe Admin::UsersController do
it
'sets the new password to expire immediately'
do
it
'sets the new password to expire immediately'
do
expect
{
update_password
(
user
,
'AValidPassword1'
)
}
expect
{
update_password
(
user
,
'AValidPassword1'
)
}
.
to
change
{
user
.
reload
.
password_expires_at
}.
to
be_within
(
2
.
seconds
).
of
(
Time
.
now
)
.
to
change
{
user
.
reload
.
password_expires_at
}.
to
be_within
(
2
.
seconds
).
of
(
Time
.
current
)
end
end
end
end
...
...
spec/controllers/application_controller_spec.rb
View file @
ced4f681
...
@@ -25,7 +25,7 @@ describe ApplicationController do
...
@@ -25,7 +25,7 @@ describe ApplicationController do
end
end
it
'does not redirect if the user is under their password expiry'
do
it
'does not redirect if the user is under their password expiry'
do
user
.
password_expires_at
=
Time
.
now
+
20010101
user
.
password_expires_at
=
Time
.
current
+
20010101
expect
(
user
.
ldap_user?
).
to
be_falsey
expect
(
user
.
ldap_user?
).
to
be_falsey
allow
(
controller
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
controller
).
to
receive
(
:current_user
).
and_return
(
user
)
...
...
spec/controllers/import/bitbucket_controller_spec.rb
View file @
ced4f681
...
@@ -27,7 +27,7 @@ describe Import::BitbucketController do
...
@@ -27,7 +27,7 @@ describe Import::BitbucketController do
end
end
it
"updates access token"
do
it
"updates access token"
do
expires_at
=
Time
.
now
+
1
.
day
expires_at
=
Time
.
current
+
1
.
day
expires_in
=
1
.
day
expires_in
=
1
.
day
access_token
=
double
(
token:
token
,
access_token
=
double
(
token:
token
,
secret:
secret
,
secret:
secret
,
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
ced4f681
...
@@ -609,7 +609,7 @@ describe Projects::IssuesController do
...
@@ -609,7 +609,7 @@ describe Projects::IssuesController do
before
do
before
do
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
issue
.
update!
(
last_edited_by:
deleted_user
,
last_edited_at:
Time
.
now
)
issue
.
update!
(
last_edited_by:
deleted_user
,
last_edited_at:
Time
.
current
)
deleted_user
.
destroy
deleted_user
.
destroy
sign_in
(
user
)
sign_in
(
user
)
...
...
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