demarches-normaliennes/spec/helpers/procedure_helper_spec.rb
Colin Darie 010c9a0dcb feat(procedure): includes read duration of explication/non fillable champs
Long explications can significantly increase global fill duration,
so we can't ignore them.

Closes #7963
2022-10-31 12:17:16 +01:00

32 lines
1,022 B
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

RSpec.describe ProcedureHelper, type: :helper do
describe '#procedure_auto_archive_datetime' do
let(:auto_archive_date) { Time.zone.local(2020, 8, 2, 12, 00) }
let(:procedure) { build(:procedure, auto_archive_on: auto_archive_date) }
subject { procedure_auto_archive_datetime(procedure) }
it "displays the day before the auto archive date (to account for the '23h59' ending time)" do
expect(subject).to have_text("1 août 2020 à 23 h 59 (heure de Paris)")
end
end
describe '#estimated_fill_duration_minutes' do
subject { estimated_fill_duration_minutes(procedure.reload) }
context 'with champs' do
let(:procedure) { create(:procedure, :with_yes_no, :with_piece_justificative) }
it 'rounds up the duration to the minute' do
expect(subject).to eq(2)
end
end
context 'without champs' do
let(:procedure) { create(:procedure) }
it 'never displays zero minutes' do
expect(subject).to eq(1)
end
end
end
end