[Ref #145] Record archived_at when archiving a procedure
This commit is contained in:
parent
698bffd156
commit
6b90e0ccfa
2 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue