Commit 6a88a222 authored by Sean Arnold's avatar Sean Arnold

Update specs and and service with correct timezone

parent 87e5f74f
......@@ -4,7 +4,7 @@ module ResourceEvents
class ChangeMilestoneService
attr_reader :resource, :user, :event_created_at, :milestone, :old_milestone
def initialize(resource, user, created_at: Time.now, old_milestone:)
def initialize(resource, user, created_at: Time.current, old_milestone:)
@resource = resource
@user = user
@event_created_at = created_at
......
......@@ -35,7 +35,7 @@ describe Auth::ContainerRegistryAuthenticationService do
it { expect(payload).to include('access') }
context 'a expirable' do
let(:expires_at) { Time.at(payload['exp']) }
let(:expires_at) { Time.zone.at(payload['exp']) }
let(:expire_delay) { 10 }
context 'for default configuration' do
......
......@@ -571,7 +571,7 @@ module Ci
end
describe '#register_success' do
let!(:current_time) { Time.new(2018, 4, 5, 14, 0, 0) }
let!(:current_time) { Time.new.in_time_zone(2018, 4, 5, 14, 0, 0) }
let!(:attempt_counter) { double('Gitlab::Metrics::NullMetric') }
let!(:job_queue_duration_seconds) { double('Gitlab::Metrics::NullMetric') }
......
......@@ -30,13 +30,13 @@ describe NoteSummary do
end
context 'when noteable is a commit' do
let(:noteable) { build(:commit, system_note_timestamp: Time.at(43)) }
let(:noteable) { build(:commit, system_note_timestamp: Time.zone.at(43)) }
it 'returns note hash specific to commit' do
expect(create_note_summary.note).to eq(
noteable: nil, project: project, author: user, note: 'note',
noteable_type: 'Commit', commit_id: noteable.id,
created_at: Time.at(43)
created_at: Time.zone.at(43)
)
end
end
......
......@@ -121,7 +121,7 @@ describe Projects::Alerting::NotifyService do
expect(last_alert_attributes).to match(
project_id: project.id,
title: payload_raw.fetch(:title),
started_at: Time.parse(payload_raw.fetch(:start_time)),
started_at: Time.zone.parse(payload_raw.fetch(:start_time)),
severity: payload_raw.fetch(:severity),
status: AlertManagement::Alert::STATUSES[:triggered],
events: 1,
......@@ -154,7 +154,7 @@ describe Projects::Alerting::NotifyService do
expect(last_alert_attributes).to match(
project_id: project.id,
title: payload_raw.fetch(:title),
started_at: Time.parse(payload_raw.fetch(:start_time)),
started_at: Time.zone.parse(payload_raw.fetch(:start_time)),
severity: 'critical',
status: AlertManagement::Alert::STATUSES[:triggered],
events: 1,
......
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