[Ref #145] Record archived_at when archiving a procedure

This commit is contained in:
gregoirenovel 2017-06-27 17:05:49 +02:00
parent 698bffd156
commit 6b90e0ccfa
2 changed files with 4 additions and 2 deletions

View file

@ -116,7 +116,7 @@ class Procedure < ActiveRecord::Base
end
def archive
self.update_attributes!({archived: true})
self.update_attributes!(archived: true, archived_at: Time.now)
end
def total_dossier

View file

@ -227,8 +227,8 @@ describe Procedure do
let(:procedure) { create(:procedure) }
before do
procedure.publish!("example-path")
Timecop.freeze(Time.now)
procedure.publish!("example-path")
end
it { expect(procedure.published).to eq(true) }
@ -243,12 +243,14 @@ describe Procedure do
let(:procedure) { create(:procedure, :published) }
let(:procedure_path) { ProcedurePath.find(procedure.procedure_path.id) }
before do
Timecop.freeze(Time.now)
procedure.archive
procedure.reload
end
it { expect(procedure.published).to be_truthy }
it { expect(procedure.archived).to be_truthy }
it { expect(procedure.archived_at).to eq(Time.now) }
end
describe 'total_dossier' do