Merge pull request #540 from sgmap/fix_circle_ci_fails_when_comparing_datetimes
Fix tests that often fail on circle ci when comparing datetimes
This commit is contained in:
commit
2971629f83
1 changed files with 14 additions and 4 deletions
|
@ -225,32 +225,42 @@ describe Procedure do
|
||||||
|
|
||||||
describe '#publish!' do
|
describe '#publish!' do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
|
let(:now) { Time.now.beginning_of_minute }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Timecop.freeze(Time.now)
|
Timecop.freeze(now)
|
||||||
procedure.publish!("example-path")
|
procedure.publish!("example-path")
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(procedure.published).to eq(true) }
|
it { expect(procedure.published).to eq(true) }
|
||||||
it { expect(procedure.archived).to eq(false) }
|
it { expect(procedure.archived).to eq(false) }
|
||||||
it { expect(procedure.published_at).to eq(Time.now) }
|
it { expect(procedure.published_at).to eq(now) }
|
||||||
it { expect(ProcedurePath.find_by_path("example-path")).to be }
|
it { expect(ProcedurePath.find_by_path("example-path")).to be }
|
||||||
it { expect(ProcedurePath.find_by_path("example-path").procedure).to eq(procedure) }
|
it { expect(ProcedurePath.find_by_path("example-path").procedure).to eq(procedure) }
|
||||||
it { expect(ProcedurePath.find_by_path("example-path").administrateur).to eq(procedure.administrateur) }
|
it { expect(ProcedurePath.find_by_path("example-path").administrateur).to eq(procedure.administrateur) }
|
||||||
|
|
||||||
|
after do
|
||||||
|
Timecop.return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'archive' do
|
describe 'archive' do
|
||||||
let(:procedure) { create(:procedure, :published) }
|
let(:procedure) { create(:procedure, :published) }
|
||||||
let(:procedure_path) { ProcedurePath.find(procedure.procedure_path.id) }
|
let(:procedure_path) { ProcedurePath.find(procedure.procedure_path.id) }
|
||||||
|
let(:now) { Time.now.beginning_of_minute }
|
||||||
before do
|
before do
|
||||||
Timecop.freeze(Time.now)
|
Timecop.freeze(now)
|
||||||
procedure.archive
|
procedure.archive
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(procedure.published).to be_truthy }
|
it { expect(procedure.published).to be_truthy }
|
||||||
it { expect(procedure.archived).to be_truthy }
|
it { expect(procedure.archived).to be_truthy }
|
||||||
it { expect(procedure.archived_at).to eq(Time.now) }
|
it { expect(procedure.archived_at).to eq(now) }
|
||||||
|
|
||||||
|
after do
|
||||||
|
Timecop.return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'total_dossier' do
|
describe 'total_dossier' do
|
||||||
|
|
Loading…
Reference in a new issue