diff --git a/config/features.rb b/config/features.rb index 79288b39f..e9eb6c48d 100644 --- a/config/features.rb +++ b/config/features.rb @@ -20,7 +20,8 @@ Flipflop.configure do feature :support_form feature :new_dossier_details, - title: "Nouvelle page « Dossier »" + title: "Nouvelle page « Dossier »", + default: true group :production do feature :remote_storage, diff --git a/spec/controllers/new_user/dossiers_controller_spec.rb b/spec/controllers/new_user/dossiers_controller_spec.rb index de694100a..c7c60bcc6 100644 --- a/spec/controllers/new_user/dossiers_controller_spec.rb +++ b/spec/controllers/new_user/dossiers_controller_spec.rb @@ -434,7 +434,7 @@ describe NewUser::DossiersController, type: :controller do it 'updates the champs' do subject - expect(response).to redirect_to(users_dossier_recapitulatif_path(dossier)) + expect(response).to redirect_to(demande_dossier_path(dossier)) expect(first_champ.reload.value).to eq('beautiful value') expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction)) end @@ -490,7 +490,7 @@ describe NewUser::DossiersController, type: :controller do it 'does not raise any errors' do subject - expect(response).to redirect_to(users_dossier_recapitulatif_path(dossier)) + expect(response).to redirect_to(demande_dossier_path(dossier)) end end @@ -505,7 +505,7 @@ describe NewUser::DossiersController, type: :controller do it { expect(first_champ.reload.value).to eq('beautiful value') } it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction)) } - it { expect(response).to redirect_to(users_dossiers_invite_path(invite)) } + it { expect(response).to redirect_to(demande_dossier_path(dossier)) } end end diff --git a/spec/controllers/users/dossiers/invites_controller_spec.rb b/spec/controllers/users/dossiers/invites_controller_spec.rb index ba23279b7..38ec5d6d2 100644 --- a/spec/controllers/users/dossiers/invites_controller_spec.rb +++ b/spec/controllers/users/dossiers/invites_controller_spec.rb @@ -16,7 +16,7 @@ describe Users::Dossiers::InvitesController, type: :controller do context 'and user is connected' do let(:invite) { create :invite, dossier: dossier, user: user } before { sign_in invite.user } - it { is_expected.to have_http_status(:ok) } + it { is_expected.to redirect_to(dossier_path(dossier)) } end end @@ -54,23 +54,17 @@ describe Users::Dossiers::InvitesController, type: :controller do context 'and dossier is a brouillon' do let(:dossier) { create :dossier, state: Dossier.states.fetch(:brouillon) } - - it { is_expected.to have_http_status(302) } it { is_expected.to redirect_to brouillon_dossier_path(dossier) } end context 'and dossier is not a brouillon' do let(:dossier) { create :dossier, :en_construction } - - it { is_expected.to have_http_status(:ok) } - it { is_expected.to render_template('users/recapitulatif/show') } + it { is_expected.to redirect_to(dossier_path(dossier)) } end end context 'when invitation ID is not attached at the user email account' do let(:email) { 'fake@email.com' } - - it { is_expected.to have_http_status(302) } it { is_expected.to redirect_to dossiers_path } it { expect(flash[:alert]).to be_present } end diff --git a/spec/controllers/users/recapitulatif_controller_spec.rb b/spec/controllers/users/recapitulatif_controller_spec.rb index ee1844f12..483c34bba 100644 --- a/spec/controllers/users/recapitulatif_controller_spec.rb +++ b/spec/controllers/users/recapitulatif_controller_spec.rb @@ -11,7 +11,7 @@ describe Users::RecapitulatifController, type: :controller do describe 'GET #show' do it 'returns http success' do get :show, params: { dossier_id: dossier.id } - expect(response).to have_http_status(:success) + expect(response).to redirect_to(dossier_path(dossier)) end it 'redirection vers siret si mauvais dossier ID' do diff --git a/spec/features/new_user/invite_spec.rb b/spec/features/new_user/invite_spec.rb index cdbb5d14c..70d3614f3 100644 --- a/spec/features/new_user/invite_spec.rb +++ b/spec/features/new_user/invite_spec.rb @@ -104,6 +104,10 @@ feature 'Invitations' do context 'when the dossier is en_construction (legacy UI)' do let!(:dossier) { create(:dossier, :for_individual, :en_construction, user: owner, procedure: procedure) } + before do + Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, false) + end + scenario 'on dossier details, a user can invite another user to collaborate on the dossier', js: true do log_in(owner) navigate_to_recapitulatif(dossier) diff --git a/spec/features/new_user/list_dossiers_spec.rb b/spec/features/new_user/list_dossiers_spec.rb index b3c7cc9d7..999aef5d6 100644 --- a/spec/features/new_user/list_dossiers_spec.rb +++ b/spec/features/new_user/list_dossiers_spec.rb @@ -48,7 +48,7 @@ describe 'user access to the list of his dossier' do page.click_on(dossier1.procedure.libelle) end scenario 'user is redirected to dossier page' do - expect(page).to have_css('#users-recapitulatif-dossier-show') + expect(page).to have_current_path(dossier_path(dossier1)) end end @@ -93,7 +93,7 @@ describe 'user access to the list of his dossier' do end it "redirects to the dossier page" do - expect(current_path).to eq(users_dossier_recapitulatif_path(dossier1)) + expect(current_path).to eq(dossier_path(dossier1)) end end end diff --git a/spec/features/users/flux_de_commentaires_spec.rb b/spec/features/users/flux_de_commentaires_spec.rb index d6072e788..12b7ec552 100644 --- a/spec/features/users/flux_de_commentaires_spec.rb +++ b/spec/features/users/flux_de_commentaires_spec.rb @@ -14,6 +14,7 @@ feature 'users: flux de commentaires' do let!(:commentaire4) { create(:commentaire, dossier: dossier, champ: champ1) } before do + Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, false) login_as user, scope: :user visit users_dossier_recapitulatif_path(dossier) end diff --git a/spec/helpers/dossier_helper_spec.rb b/spec/helpers/dossier_helper_spec.rb index 56330c487..d2d3de31d 100644 --- a/spec/helpers/dossier_helper_spec.rb +++ b/spec/helpers/dossier_helper_spec.rb @@ -36,7 +36,7 @@ RSpec.describe DossierHelper, type: :helper do context "when the dossier is any other state" do let(:dossier) { create(:dossier, state: Dossier.states.fetch(:en_construction)) } - it { is_expected.to eq "/users/dossiers/#{dossier.id}/recapitulatif" } + it { is_expected.to eq "/dossiers/#{dossier.id}" } end end diff --git a/spec/views/new_user/dossiers/index.html.haml_spec.rb b/spec/views/new_user/dossiers/index.html.haml_spec.rb index f2b0bebc5..e8430093f 100644 --- a/spec/views/new_user/dossiers/index.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/index.html.haml_spec.rb @@ -30,7 +30,7 @@ describe 'new_user/dossiers/index.html.haml', type: :view do expect(rendered).to have_text(dossier_en_construction.id) expect(rendered).to have_text(dossier_en_construction.procedure.libelle) - expect(rendered).to have_link(dossier_en_construction.id, href: users_dossier_recapitulatif_path(dossier_en_construction)) + expect(rendered).to have_link(dossier_en_construction.id, href: dossier_path(dossier_en_construction)) end context 'quand il n’y a aucun dossier' do