From 3078b377c7f392cc2aa58b1e25dfdf63a63ac119 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Thu, 25 Oct 2018 15:21:06 +0200 Subject: [PATCH] Time.new => Time.zone.local --- spec/controllers/stats_controller_spec.rb | 2 +- spec/decorators/dossier_decorator_spec.rb | 4 ++-- spec/decorators/procedure_decorator_spec.rb | 4 ++-- spec/decorators/procedures_decorator_spec.rb | 6 +++--- spec/models/procedure_spec.rb | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/controllers/stats_controller_spec.rb b/spec/controllers/stats_controller_spec.rb index 62d9184f5..b7d39e467 100644 --- a/spec/controllers/stats_controller_spec.rb +++ b/spec/controllers/stats_controller_spec.rb @@ -53,7 +53,7 @@ describe StatsController, type: :controller do describe '#cumulative_hash' do before do - Timecop.freeze(Time.new(2016, 10, 2)) + Timecop.freeze(Time.zone.local(2016, 10, 2)) FactoryBot.create(:procedure, :created_at => 55.days.ago, :updated_at => 43.days.ago) FactoryBot.create(:procedure, :created_at => 45.days.ago, :updated_at => 40.days.ago) FactoryBot.create(:procedure, :created_at => 45.days.ago, :updated_at => 20.days.ago) diff --git a/spec/decorators/dossier_decorator_spec.rb b/spec/decorators/dossier_decorator_spec.rb index a6be8c83e..184d28407 100644 --- a/spec/decorators/dossier_decorator_spec.rb +++ b/spec/decorators/dossier_decorator_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe DossierDecorator do let(:dossier) do - dossier = create(:dossier, created_at: Time.new(2015, 12, 24, 14, 10)) - dossier.update_column('updated_at', Time.new(2015, 12, 24, 14, 10)) + dossier = create(:dossier, created_at: Time.zone.local(2015, 12, 24, 14, 10)) + dossier.update_column('updated_at', Time.zone.local(2015, 12, 24, 14, 10)) dossier end diff --git a/spec/decorators/procedure_decorator_spec.rb b/spec/decorators/procedure_decorator_spec.rb index 8fba48bba..742db1047 100644 --- a/spec/decorators/procedure_decorator_spec.rb +++ b/spec/decorators/procedure_decorator_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' describe ProcedureDecorator do - let(:published_at) { Time.new(2017, 12, 24, 14, 12) } - let(:procedure) { create(:procedure, published_at: published_at, created_at: Time.new(2015, 12, 24, 14, 10)) } + let(:published_at) { Time.zone.local(2017, 12, 24, 14, 12) } + let(:procedure) { create(:procedure, published_at: published_at, created_at: Time.zone.local(2015, 12, 24, 14, 10)) } let!(:procedure_path) { create(:procedure_path, administrateur: create(:administrateur), procedure: procedure) } subject { procedure.decorate } diff --git a/spec/decorators/procedures_decorator_spec.rb b/spec/decorators/procedures_decorator_spec.rb index 6543e539b..92f63c91e 100644 --- a/spec/decorators/procedures_decorator_spec.rb +++ b/spec/decorators/procedures_decorator_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' describe ProceduresDecorator do before do - create(:procedure, :published, created_at: Time.new(2015, 12, 24, 14, 10)) - create(:procedure, :published, created_at: Time.new(2015, 12, 24, 14, 10)) - create(:procedure, :published, created_at: Time.new(2015, 12, 24, 14, 10)) + create(:procedure, :published, created_at: Time.zone.local(2015, 12, 24, 14, 10)) + create(:procedure, :published, created_at: Time.zone.local(2015, 12, 24, 14, 10)) + create(:procedure, :published, created_at: Time.zone.local(2015, 12, 24, 14, 10)) end let(:procedure) { Procedure.all.page(1) } diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb index 14d269e41..bdd0f5f45 100644 --- a/spec/models/procedure_spec.rb +++ b/spec/models/procedure_spec.rb @@ -627,7 +627,7 @@ describe Procedure do end describe "#export_filename" do - before { Timecop.freeze(Time.new(2018, 1, 2, 23, 11, 14)) } + before { Timecop.freeze(Time.zone.local(2018, 1, 2, 23, 11, 14)) } subject { procedure.export_filename }