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
28a3062a
Commit
28a3062a
authored
Jun 15, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add space to fix time format
parent
22a7853d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
app/models/project_services/chat_message/alert_message.rb
app/models/project_services/chat_message/alert_message.rb
+1
-1
spec/models/project_services/chat_message/alert_message_spec.rb
...odels/project_services/chat_message/alert_message_spec.rb
+10
-1
No files found.
app/models/project_services/chat_message/alert_message.rb
View file @
28a3062a
...
@@ -68,7 +68,7 @@ module ChatMessage
...
@@ -68,7 +68,7 @@ module ChatMessage
# April 23rd, 2020 1:06AM UTC
# April 23rd, 2020 1:06AM UTC
def
format_time
(
time
)
def
format_time
(
time
)
time
=
Time
.
zone
.
parse
(
time
.
to_s
)
time
=
Time
.
zone
.
parse
(
time
.
to_s
)
time
.
strftime
(
"%B
#{
time
.
day
.
ordinalize
}
, %Y%l:%M%p %Z"
)
time
.
strftime
(
"%B
#{
time
.
day
.
ordinalize
}
, %Y
%l:%M%p %Z"
)
end
end
end
end
end
end
spec/models/project_services/chat_message/alert_message_spec.rb
View file @
28a3062a
...
@@ -5,7 +5,8 @@ require 'spec_helper'
...
@@ -5,7 +5,8 @@ require 'spec_helper'
describe
ChatMessage
::
AlertMessage
do
describe
ChatMessage
::
AlertMessage
do
subject
{
described_class
.
new
(
args
)
}
subject
{
described_class
.
new
(
args
)
}
let
(
:alert
)
{
create
(
:alert_management_alert
)
}
let_it_be
(
:start_time
)
{
Time
.
current
}
let
(
:alert
)
{
create
(
:alert_management_alert
,
started_at:
start_time
)
}
let
(
:args
)
do
let
(
:args
)
do
{
{
...
@@ -44,5 +45,13 @@ describe ChatMessage::AlertMessage do
...
@@ -44,5 +45,13 @@ describe ChatMessage::AlertMessage do
expect
(
fields
).
to
match_array
([
'Severity'
,
'Events'
,
'Status'
,
'Start time'
])
expect
(
fields
).
to
match_array
([
'Severity'
,
'Events'
,
'Status'
,
'Start time'
])
end
end
it
'returns the correctly formatted time'
do
time_item
=
subject
.
attachments
.
first
[
:fields
].
detect
{
|
h
|
h
[
:title
]
==
'Start time'
}
expected_time
=
start_time
.
strftime
(
"%B
#{
start_time
.
day
.
ordinalize
}
, %Y %l:%M%p %Z"
)
expect
(
time_item
[
:value
]).
to
eq
(
expected_time
)
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment