This commit is contained in:
simon lehericey 2018-10-25 17:03:03 +02:00
parent 5aee0e7d40
commit 9475795143
4 changed files with 14 additions and 10 deletions

View file

@ -7,7 +7,11 @@ namespace :'2018_09_12_fix_templates' do
end end
# 16:15 in Paris -> 14:15 UTC # 16:15 in Paris -> 14:15 UTC
DEPLOY_DATETIME = Time.zone.local(2018, 9, 5, 14, 15, 0)
# rubocop:disable Rails/TimeZone
# because we are in a ruby context so Time.zone = nil
DEPLOY_DATETIME = Time.local(2018, 9, 5, 14, 15, 0)
# rubocop:enable Rails/TimeZone
def find_dossiers_with_sent_and_invalid_attestations def find_dossiers_with_sent_and_invalid_attestations
invalid_procedures_ids = AttestationTemplate invalid_procedures_ids = AttestationTemplate

View file

@ -40,7 +40,7 @@ describe API::V1::DossiersController do
context 'when procedure is found and belongs to admin' do context 'when procedure is found and belongs to admin' do
let(:procedure_id) { procedure.id } let(:procedure_id) { procedure.id }
let(:date_creation) { Time.utc(2008, 9, 1, 10, 5, 0) } let(:date_creation) { Time.zone.local(2008, 9, 1, 10, 5, 0) }
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, :en_construction, procedure: procedure) } } let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, :en_construction, procedure: procedure) } }
let(:body) { JSON.parse(retour.body, symbolize_names: true) } let(:body) { JSON.parse(retour.body, symbolize_names: true) }
@ -75,8 +75,8 @@ describe API::V1::DossiersController do
describe 'dossier' do describe 'dossier' do
subject { super().first } subject { super().first }
it { expect(subject[:id]).to eq(dossier.id) } it { expect(subject[:id]).to eq(dossier.id) }
it { expect(subject[:updated_at]).to eq("2008-09-01T10:05:00.000Z") } it { expect(subject[:updated_at]).to eq("2008-09-01T10:05:00.000+02:00") }
it { expect(subject[:initiated_at]).to eq("2008-09-01T10:06:00.000Z") } it { expect(subject[:initiated_at]).to eq("2008-09-01T10:06:00.000+02:00") }
it { expect(subject[:state]).to eq("initiated") } it { expect(subject[:state]).to eq("initiated") }
it { expect(subject.keys.size).to eq(4) } it { expect(subject.keys.size).to eq(4) }
end end
@ -135,7 +135,7 @@ describe API::V1::DossiersController do
context 'when dossier exists and belongs to procedure' do context 'when dossier exists and belongs to procedure' do
let(:procedure_id) { procedure.id } let(:procedure_id) { procedure.id }
let(:date_creation) { Time.utc(2008, 9, 1, 10, 5, 0) } let(:date_creation) { Time.zone.local(2008, 9, 1, 10, 5, 0) }
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure, motivation: "Motivation") } } let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure, motivation: "Motivation") } }
let(:dossier_id) { dossier.id } let(:dossier_id) { dossier.id }
let(:body) { JSON.parse(retour.body, symbolize_names: true) } let(:body) { JSON.parse(retour.body, symbolize_names: true) }
@ -148,8 +148,8 @@ describe API::V1::DossiersController do
it { expect(subject[:id]).to eq(dossier.id) } it { expect(subject[:id]).to eq(dossier.id) }
it { expect(subject[:state]).to eq(dossier.state) } it { expect(subject[:state]).to eq(dossier.state) }
it { expect(subject[:created_at]).to eq('2008-09-01T10:05:00.000Z') } it { expect(subject[:created_at]).to eq('2008-09-01T10:05:00.000+02:00') }
it { expect(subject[:updated_at]).to eq('2008-09-01T10:05:00.000Z') } it { expect(subject[:updated_at]).to eq('2008-09-01T10:05:00.000+02:00') }
it { expect(subject[:archived]).to eq(dossier.archived) } it { expect(subject[:archived]).to eq(dossier.archived) }
it { expect(subject.keys).to match_array(field_list) } it { expect(subject.keys).to match_array(field_list) }
@ -337,7 +337,7 @@ describe API::V1::DossiersController do
it { expect(subject.size).to eq 2 } it { expect(subject.size).to eq 2 }
it { expect(subject.first[:body]).to eq 'plop' } it { expect(subject.first[:body]).to eq 'plop' }
it { expect(subject.first[:created_at]).to eq '2016-03-14T14:00:00.000Z' } it { expect(subject.first[:created_at]).to eq '2016-03-14T14:00:00.000+01:00' }
it { expect(subject.first[:email]).to eq 'plop@plip.com' } it { expect(subject.first[:email]).to eq 'plop@plip.com' }
end end

View file

@ -82,7 +82,7 @@ describe FranceConnect::ParticulierController, type: :controller do
before { subject } before { subject }
it { expect(stored_fci).to have_attributes(user_info.merge(birthdate: Time.zone.parse(birthdate))) } it { expect(stored_fci).to have_attributes(user_info.merge(birthdate: Date.parse(birthdate))) }
end end
it { is_expected.to redirect_to(root_path) } it { is_expected.to redirect_to(root_path) }

View file

@ -33,7 +33,7 @@ describe FranceConnectService do
expect(subject).to have_attributes({ expect(subject).to have_attributes({
given_name: given_name, given_name: given_name,
family_name: family_name, family_name: family_name,
birthdate: Time.zone.parse(birthdate), birthdate: Date.parse(birthdate),
birthplace: birthplace, birthplace: birthplace,
gender: gender, gender: gender,
email_france_connect: email, email_france_connect: email,