Commit 28a3062a authored by Sean Arnold's avatar Sean Arnold

Add space to fix time format

parent 22a7853d
......@@ -68,7 +68,7 @@ module ChatMessage
# April 23rd, 2020 1:06AM UTC
def format_time(time)
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
......@@ -5,7 +5,8 @@ require 'spec_helper'
describe ChatMessage::AlertMessage do
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
{
......@@ -44,5 +45,13 @@ describe ChatMessage::AlertMessage do
expect(fields).to match_array(['Severity', 'Events', 'Status', 'Start time'])
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment