Merge pull request #5791 from betagouv/fix_bill_signature
Répare l'horodatage
This commit is contained in:
commit
f0b1832845
2 changed files with 13 additions and 1 deletions
|
@ -49,7 +49,7 @@ class BillSignature < ApplicationRecord
|
|||
end
|
||||
|
||||
def set_signature(signature, day)
|
||||
signature.attach(
|
||||
self.signature.attach(
|
||||
io: StringIO.new(signature),
|
||||
filename: "demarches-simplifiees-signature-#{day.to_date.iso8601}.der",
|
||||
content_type: 'application/x-x509-ca-cert'
|
||||
|
|
|
@ -161,4 +161,16 @@ RSpec.describe BillSignature, type: :model do
|
|||
it { expect(bill_signature.serialized.filename).to eq('demarches-simplifiees-operations-1871-03-18.json') }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#set_signature' do
|
||||
let(:bill_signature) { BillSignature.new }
|
||||
let(:signature) { 'une belle signature' }
|
||||
let(:day) { Time.zone.parse('12/12/2012') }
|
||||
|
||||
before { bill_signature.set_signature(signature, day) }
|
||||
|
||||
it { expect(bill_signature.signature.attached?).to be(true) }
|
||||
it { expect(bill_signature.signature.filename.to_s).to eq('demarches-simplifiees-signature-2012-12-12.der') }
|
||||
it { expect(bill_signature.signature.content_type).to eq('application/x-x509-ca-cert') }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue