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
Show 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
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
)
end
...
...
app/controllers/concerns/notes_actions.rb
View file @
ced4f681
...
...
@@ -13,7 +13,7 @@ module NotesActions
end
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
}
...
...
app/controllers/user_callouts_controller.rb
View file @
ced4f681
...
...
@@ -5,7 +5,7 @@ class UserCalloutsController < ApplicationController
callout
=
ensure_callout
if
callout
.
persisted?
callout
.
update
(
dismissed_at:
Time
.
now
)
callout
.
update
(
dismissed_at:
Time
.
current
)
respond_to
do
|
format
|
format
.
json
{
head
:ok
}
end
...
...
ee/app/controllers/ee/groups_controller.rb
View file @
ced4f681
...
...
@@ -34,7 +34,7 @@ module EE
if
result
[
:status
]
==
:success
redirect_to
group_path
(
group
),
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
redirect_to
edit_group_path
(
group
),
status: :found
,
alert:
result
[
:message
]
end
...
...
ee/app/controllers/ee/projects/mirrors_controller.rb
View file @
ced4f681
...
...
@@ -90,7 +90,7 @@ module EE
# If the known hosts data is being set, store details about who and when
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
end
end
...
...
ee/app/controllers/projects/security/network_policies_controller.rb
View file @
ced4f681
...
...
@@ -18,7 +18,7 @@ module Projects
:packet_flow
,
environment
.
deployment_namespace
,
params
[
:interval
]
||
"minute"
,
(
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
|
...
...
ee/spec/controllers/admin/application_settings_controller_spec.rb
View file @
ced4f681
...
...
@@ -256,7 +256,7 @@ describe Admin::ApplicationSettingsController do
end
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
(
: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
subject
{
get
:duration_chart
,
params:
params
}
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
)
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
subject
{
get
:duration_chart
,
params:
params
}
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
)
subject
...
...
ee/spec/controllers/groups/contribution_analytics_controller_spec.rb
View file @
ced4f681
...
...
@@ -19,7 +19,7 @@ describe Groups::ContributionAnalyticsController do
action:
action
,
target:
target
,
author:
author
,
created_at:
Time
.
now
)
created_at:
Time
.
current
)
end
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
context
'when state_event param is reopen'
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
it
'allows epic to be reopened'
do
...
...
ee/spec/controllers/operations_controller_spec.rb
View file @
ced4f681
...
...
@@ -73,7 +73,7 @@ describe OperationsController do
end
describe
'GET #list'
do
let
(
:now
)
{
Time
.
now
.
change
(
usec:
0
)
}
let
(
:now
)
{
Time
.
current
.
change
(
usec:
0
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
}
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
render_views
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
}
end
...
...
ee/spec/controllers/projects/mirrors_controller_spec.rb
View file @
ced4f681
...
...
@@ -172,7 +172,7 @@ describe Projects::MirrorsController do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
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
)
end
...
...
ee/spec/controllers/projects/security/network_policies_controller_spec.rb
View file @
ced4f681
...
...
@@ -40,7 +40,7 @@ describe Projects::Security::NetworkPoliciesController do
Timecop
.
freeze
do
expect
(
adapter
).
to
(
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
}
})
)
subject
...
...
@@ -81,7 +81,7 @@ describe Projects::Security::NetworkPoliciesController do
Timecop
.
freeze
do
expect
(
adapter
).
to
(
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:
{}
})
)
subject
...
...
spec/controllers/admin/requests_profiles_controller_spec.rb
View file @
ced4f681
...
...
@@ -27,7 +27,7 @@ describe Admin::RequestsProfilesController do
end
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
'<html> <body> <h1>Heading</h1> <p>paragraph.</p> </body> </html>'
...
...
@@ -42,7 +42,7 @@ describe Admin::RequestsProfilesController do
end
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
<<~
TXT
...
...
@@ -60,7 +60,7 @@ describe Admin::RequestsProfilesController do
end
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'
}
...
...
spec/controllers/admin/users_controller_spec.rb
View file @
ced4f681
...
...
@@ -296,7 +296,7 @@ describe Admin::UsersController do
it
'sets the new password to expire immediately'
do
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
...
...
spec/controllers/application_controller_spec.rb
View file @
ced4f681
...
...
@@ -25,7 +25,7 @@ describe ApplicationController do
end
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
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
end
it
"updates access token"
do
expires_at
=
Time
.
now
+
1
.
day
expires_at
=
Time
.
current
+
1
.
day
expires_in
=
1
.
day
access_token
=
double
(
token:
token
,
secret:
secret
,
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
ced4f681
...
...
@@ -609,7 +609,7 @@ describe Projects::IssuesController do
before
do
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
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