helper: simplify DossierHelper.url_for_dossier

The argument is never an Invite
This commit is contained in:
Pierre de La Morinerie 2018-07-04 09:59:35 +02:00 committed by gregoirenovel
parent b6ea2f1b36
commit 33c743ab77
2 changed files with 1 additions and 8 deletions

View file

@ -16,9 +16,7 @@ module DossierHelper
end end
def url_for_dossier(dossier) def url_for_dossier(dossier)
if dossier.kind_of? Invite if dossier.brouillon?
users_dossiers_invite_path(id: dossier.id)
elsif dossier.brouillon?
modifier_dossier_path(dossier) modifier_dossier_path(dossier)
else else
users_dossier_recapitulatif_path(dossier) users_dossier_recapitulatif_path(dossier)

View file

@ -29,11 +29,6 @@ RSpec.describe DossierHelper, type: :helper do
describe ".url_for_dossier" do describe ".url_for_dossier" do
subject { url_for_dossier(dossier) } subject { url_for_dossier(dossier) }
context "when the dossier is an invitation" do
let(:dossier) { create(:invite) }
it { is_expected.to eq "/users/dossiers/invites/#{dossier.id}" }
end
context "when the dossier is in the brouillon state" do context "when the dossier is in the brouillon state" do
let(:dossier) { create(:dossier, state: 'brouillon') } let(:dossier) { create(:dossier, state: 'brouillon') }
it { is_expected.to eq "/dossiers/#{dossier.id}/modifier" } it { is_expected.to eq "/dossiers/#{dossier.id}/modifier" }