dossier: enable new UI by default

This commit is contained in:
Pierre de La Morinerie 2018-09-27 14:52:17 +00:00
parent 1cf316017f
commit f007eaa2ee
9 changed files with 17 additions and 17 deletions

View file

@ -20,7 +20,8 @@ Flipflop.configure do
feature :support_form feature :support_form
feature :new_dossier_details, feature :new_dossier_details,
title: "Nouvelle page « Dossier »" title: "Nouvelle page « Dossier »",
default: true
group :production do group :production do
feature :remote_storage, feature :remote_storage,

View file

@ -434,7 +434,7 @@ describe NewUser::DossiersController, type: :controller do
it 'updates the champs' do it 'updates the champs' do
subject 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(first_champ.reload.value).to eq('beautiful value')
expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction)) expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction))
end end
@ -490,7 +490,7 @@ describe NewUser::DossiersController, type: :controller do
it 'does not raise any errors' do it 'does not raise any errors' do
subject subject
expect(response).to redirect_to(users_dossier_recapitulatif_path(dossier)) expect(response).to redirect_to(demande_dossier_path(dossier))
end end
end end
@ -505,7 +505,7 @@ describe NewUser::DossiersController, type: :controller do
it { expect(first_champ.reload.value).to eq('beautiful value') } it { expect(first_champ.reload.value).to eq('beautiful value') }
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction)) } 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
end end

View file

@ -16,7 +16,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
context 'and user is connected' do context 'and user is connected' do
let(:invite) { create :invite, dossier: dossier, user: user } let(:invite) { create :invite, dossier: dossier, user: user }
before { sign_in invite.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
end end
@ -54,23 +54,17 @@ describe Users::Dossiers::InvitesController, type: :controller do
context 'and dossier is a brouillon' do context 'and dossier is a brouillon' do
let(:dossier) { create :dossier, state: Dossier.states.fetch(:brouillon) } 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) } it { is_expected.to redirect_to brouillon_dossier_path(dossier) }
end end
context 'and dossier is not a brouillon' do context 'and dossier is not a brouillon' do
let(:dossier) { create :dossier, :en_construction } let(:dossier) { create :dossier, :en_construction }
it { is_expected.to redirect_to(dossier_path(dossier)) }
it { is_expected.to have_http_status(:ok) }
it { is_expected.to render_template('users/recapitulatif/show') }
end end
end end
context 'when invitation ID is not attached at the user email account' do context 'when invitation ID is not attached at the user email account' do
let(:email) { 'fake@email.com' } let(:email) { 'fake@email.com' }
it { is_expected.to have_http_status(302) }
it { is_expected.to redirect_to dossiers_path } it { is_expected.to redirect_to dossiers_path }
it { expect(flash[:alert]).to be_present } it { expect(flash[:alert]).to be_present }
end end

View file

@ -11,7 +11,7 @@ describe Users::RecapitulatifController, type: :controller do
describe 'GET #show' do describe 'GET #show' do
it 'returns http success' do it 'returns http success' do
get :show, params: { dossier_id: dossier.id } get :show, params: { dossier_id: dossier.id }
expect(response).to have_http_status(:success) expect(response).to redirect_to(dossier_path(dossier))
end end
it 'redirection vers siret si mauvais dossier ID' do it 'redirection vers siret si mauvais dossier ID' do

View file

@ -104,6 +104,10 @@ feature 'Invitations' do
context 'when the dossier is en_construction (legacy UI)' do context 'when the dossier is en_construction (legacy UI)' do
let!(:dossier) { create(:dossier, :for_individual, :en_construction, user: owner, procedure: procedure) } 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 scenario 'on dossier details, a user can invite another user to collaborate on the dossier', js: true do
log_in(owner) log_in(owner)
navigate_to_recapitulatif(dossier) navigate_to_recapitulatif(dossier)

View file

@ -48,7 +48,7 @@ describe 'user access to the list of his dossier' do
page.click_on(dossier1.procedure.libelle) page.click_on(dossier1.procedure.libelle)
end end
scenario 'user is redirected to dossier page' do 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
end end
@ -93,7 +93,7 @@ describe 'user access to the list of his dossier' do
end end
it "redirects to the dossier page" do 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 end
end end

View file

@ -14,6 +14,7 @@ feature 'users: flux de commentaires' do
let!(:commentaire4) { create(:commentaire, dossier: dossier, champ: champ1) } let!(:commentaire4) { create(:commentaire, dossier: dossier, champ: champ1) }
before do before do
Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, false)
login_as user, scope: :user login_as user, scope: :user
visit users_dossier_recapitulatif_path(dossier) visit users_dossier_recapitulatif_path(dossier)
end end

View file

@ -36,7 +36,7 @@ RSpec.describe DossierHelper, type: :helper do
context "when the dossier is any other state" do context "when the dossier is any other state" do
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:en_construction)) } 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
end end

View file

@ -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.id)
expect(rendered).to have_text(dossier_en_construction.procedure.libelle) 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 end
context 'quand il ny a aucun dossier' do context 'quand il ny a aucun dossier' do