From cf69c28979fabaac44c67ece6f795fb20c25f24a Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 2 Oct 2018 10:14:38 +0200 Subject: [PATCH 1/4] Fix scope for logo/notice/deliberation deletion --- .../admin/procedures_controller.rb | 22 +++----- .../admin/procedures_controller_spec.rb | 50 ++++++++++++++++--- 2 files changed, 52 insertions(+), 20 deletions(-) diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index f8f283c79..f004c76f7 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -2,7 +2,7 @@ class Admin::ProceduresController < AdminController include SmartListing::Helper::ControllerExtensions helper SmartListing::Helper - before_action :retrieve_procedure, only: [:show, :edit] + before_action :retrieve_procedure, only: [:show, :edit, :delete_logo, :delete_deliberation, :delete_notice] def index @procedures = smart_listing_create :procedures, @@ -252,31 +252,25 @@ class Admin::ProceduresController < AdminController end def delete_logo - procedure = Procedure.find(params[:id]) - - procedure.remove_logo! - procedure.save + @procedure.remove_logo! + @procedure.save flash.notice = 'le logo a bien été supprimé' - redirect_to edit_admin_procedure_path(procedure) + redirect_to edit_admin_procedure_path(@procedure) end def delete_deliberation - procedure = Procedure.find(params[:id]) - - procedure.deliberation.purge_later + @procedure.deliberation.purge_later flash.notice = 'la délibération a bien été supprimée' - redirect_to edit_admin_procedure_path(procedure) + redirect_to edit_admin_procedure_path(@procedure) end def delete_notice - procedure = Procedure.find(params[:id]) - - procedure.notice.purge_later + @procedure.notice.purge_later flash.notice = 'la notice a bien été supprimée' - redirect_to edit_admin_procedure_path(procedure) + redirect_to edit_admin_procedure_path(@procedure) end private diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb index 301e93094..75f3b3e4c 100644 --- a/spec/controllers/admin/procedures_controller_spec.rb +++ b/spec/controllers/admin/procedures_controller_spec.rb @@ -713,15 +713,53 @@ describe Admin::ProceduresController, type: :controller do end describe "DELETE #delete_deliberation" do - let(:procedure) { create(:procedure, :with_deliberation) } + context "with a demarche the admin owns" do + let(:procedure) { create(:procedure, :with_deliberation, administrateur: admin) } - before do - delete :delete_deliberation, params: { id: procedure.id } - procedure.reload + before do + delete :delete_deliberation, params: { id: procedure.id } + procedure.reload + end + + it { expect(procedure.deliberation.attached?).to eq(false) } + it { expect(response).to redirect_to(edit_admin_procedure_path(procedure)) } end - it { expect(procedure.deliberation.attached?).to eq(false) } - it { expect(response).to redirect_to(edit_admin_procedure_path(procedure)) } + context "with a demarche the admin does not own" do + let(:procedure) { create(:procedure, :with_deliberation) } + + before do + delete :delete_deliberation, params: { id: procedure.id } + procedure.reload + end + + it { expect(response.status).to eq(404) } + end + end + + describe "DELETE #delete_notice" do + context "with a demarche the admin owns" do + let(:procedure) { create(:procedure, :with_notice, administrateur: admin) } + + before do + delete :delete_notice, params: { id: procedure.id } + procedure.reload + end + + it { expect(procedure.notice.attached?).to eq(false) } + it { expect(response).to redirect_to(edit_admin_procedure_path(procedure)) } + end + + context "with a demarche the admin does not own" do + let(:procedure) { create(:procedure, :with_notice) } + + before do + delete :delete_notice, params: { id: procedure.id } + procedure.reload + end + + it { expect(response.status).to eq(404) } + end end describe "GET #check_availability" do From da134c6d4b9fe5791752d09d1ee7959909781ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Thu, 27 Sep 2018 17:40:34 +0200 Subject: [PATCH 2/4] Ajout d'une astuce dans l'ajout d'instructeur --- app/views/admin/instructeurs/show.html.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/admin/instructeurs/show.html.haml b/app/views/admin/instructeurs/show.html.haml index 3f0c6a2d3..83effd8c4 100644 --- a/app/views/admin/instructeurs/show.html.haml +++ b/app/views/admin/instructeurs/show.html.haml @@ -18,6 +18,9 @@ %br %br = f.submit 'Valider', class: 'btn btn-info', style: 'float: left;', id: 'add-gestionnaire-email' + %br + .alert.alert-info + Astuce : ajoutez votre adresse email pour tester la partie instructeur. .col-xs-6 %h3.text-success Affectés = smart_listing_render :instructeurs_assign From f007eaa2eee79675585e688846e6e509bfe3d195 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 27 Sep 2018 14:52:17 +0000 Subject: [PATCH 3/4] dossier: enable new UI by default --- config/features.rb | 3 ++- spec/controllers/new_user/dossiers_controller_spec.rb | 6 +++--- .../users/dossiers/invites_controller_spec.rb | 10 ++-------- .../controllers/users/recapitulatif_controller_spec.rb | 2 +- spec/features/new_user/invite_spec.rb | 4 ++++ spec/features/new_user/list_dossiers_spec.rb | 4 ++-- spec/features/users/flux_de_commentaires_spec.rb | 1 + spec/helpers/dossier_helper_spec.rb | 2 +- spec/views/new_user/dossiers/index.html.haml_spec.rb | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) 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 From 758ccff9847ae5f4cbcc40c0f576d241aaad60f7 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 2 Oct 2018 10:23:53 +0000 Subject: [PATCH 4/4] dossier: remove feature flag --- .../new_user/dossiers_controller.rb | 13 +--- .../users/dossiers/invites_controller.rb | 4 +- .../users/recapitulatif_controller.rb | 6 +- app/helpers/dossier_helper.rb | 4 +- .../dossiers/_dossier_footer.html.haml | 5 +- app/views/new_user/dossiers/merci.html.haml | 5 +- config/features.rb | 4 -- .../new_user/dossiers_controller_spec.rb | 17 +---- .../features/new_user/dossier_details_spec.rb | 1 - spec/features/new_user/invite_spec.rb | 62 ------------------- .../users/flux_de_commentaires_spec.rb | 28 --------- 11 files changed, 8 insertions(+), 141 deletions(-) delete mode 100644 spec/features/users/flux_de_commentaires_spec.rb diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index 0cdb5a55a..7093665cf 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -28,9 +28,6 @@ module NewUser def show if dossier.brouillon? redirect_to brouillon_dossier_path(dossier) - - elsif !Flipflop.new_dossier_details? - redirect_to users_dossier_recapitulatif_path(dossier) end @dossier = dossier @@ -125,15 +122,7 @@ module NewUser flash.now.alert = errors render :modifier else - if Flipflop.new_dossier_details? - redirect_to demande_dossier_path(@dossier) - else - if current_user.owns?(dossier) - redirect_to users_dossier_recapitulatif_path(@dossier) - else - redirect_to users_dossiers_invite_path(@dossier.invite_for_user(current_user)) - end - end + redirect_to demande_dossier_path(@dossier) end end diff --git a/app/controllers/users/dossiers/invites_controller.rb b/app/controllers/users/dossiers/invites_controller.rb index 880fed4c5..c766a8ce0 100644 --- a/app/controllers/users/dossiers/invites_controller.rb +++ b/app/controllers/users/dossiers/invites_controller.rb @@ -14,10 +14,8 @@ class Users::Dossiers::InvitesController < UsersController if @facade.dossier.brouillon? redirect_to brouillon_dossier_path(@facade.dossier) - elsif Flipflop.new_dossier_details? - return redirect_to dossier_path(@facade.dossier) else - render 'users/recapitulatif/show' + return redirect_to dossier_path(@facade.dossier) end rescue ActiveRecord::RecordNotFound flash.alert = t('errors.messages.dossier_not_found') diff --git a/app/controllers/users/recapitulatif_controller.rb b/app/controllers/users/recapitulatif_controller.rb index 85dea28af..4486e64d4 100644 --- a/app/controllers/users/recapitulatif_controller.rb +++ b/app/controllers/users/recapitulatif_controller.rb @@ -4,11 +4,7 @@ class Users::RecapitulatifController < UsersController end def show - if Flipflop.new_dossier_details? - redirect_to dossier_url(current_user_dossier) - else - create_dossier_facade - end + redirect_to dossier_url(current_user_dossier) end def initiate diff --git a/app/helpers/dossier_helper.rb b/app/helpers/dossier_helper.rb index 4e9367bb4..06a7001c9 100644 --- a/app/helpers/dossier_helper.rb +++ b/app/helpers/dossier_helper.rb @@ -18,10 +18,8 @@ module DossierHelper def url_for_dossier(dossier) if dossier.brouillon? brouillon_dossier_path(dossier) - elsif Flipflop.new_dossier_details? - dossier_path(dossier) else - users_dossier_recapitulatif_path(dossier) + dossier_path(dossier) end end diff --git a/app/views/new_user/dossiers/_dossier_footer.html.haml b/app/views/new_user/dossiers/_dossier_footer.html.haml index e94e44b4a..8c6f2d11f 100644 --- a/app/views/new_user/dossiers/_dossier_footer.html.haml +++ b/app/views/new_user/dossiers/_dossier_footer.html.haml @@ -20,10 +20,7 @@ = link_to service.email, "mailto:#{service.email}" - else Directement - - if Flipflop.new_dossier_details? - = link_to "par la messagerie", messagerie_dossier_path(dossier) - - else - = link_to "par la messagerie", users_dossier_recapitulatif_path(dossier) + = link_to "par la messagerie", messagerie_dossier_path(dossier) %p Par téléphone : diff --git a/app/views/new_user/dossiers/merci.html.haml b/app/views/new_user/dossiers/merci.html.haml index d0fbc9a5a..7b6667e98 100644 --- a/app/views/new_user/dossiers/merci.html.haml +++ b/app/views/new_user/dossiers/merci.html.haml @@ -18,7 +18,4 @@ %b échanger avec un instructeur lors de sa construction et de son instruction - - if Flipflop.new_dossier_details? - = link_to 'Accéder à votre dossier', dossier_path(@dossier), class: 'button large primary' - - else - = link_to 'Accéder à votre dossier', users_dossier_recapitulatif_path(@dossier), class: 'button large primary' + = link_to 'Accéder à votre dossier', dossier_path(@dossier), class: 'button large primary' diff --git a/config/features.rb b/config/features.rb index e9eb6c48d..fcc8384c7 100644 --- a/config/features.rb +++ b/config/features.rb @@ -19,10 +19,6 @@ Flipflop.configure do feature :publish_draft feature :support_form - feature :new_dossier_details, - title: "Nouvelle page « Dossier »", - default: true - group :production do feature :remote_storage, default: ENV['FOG_ENABLED'] == 'enabled' diff --git a/spec/controllers/new_user/dossiers_controller_spec.rb b/spec/controllers/new_user/dossiers_controller_spec.rb index c7c60bcc6..352d56995 100644 --- a/spec/controllers/new_user/dossiers_controller_spec.rb +++ b/spec/controllers/new_user/dossiers_controller_spec.rb @@ -578,10 +578,7 @@ describe NewUser::DossiersController, type: :controller do end describe '#show' do - let(:new_dossier_details_enabled) { false } - before do - Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, new_dossier_details_enabled) sign_in(user) end @@ -594,17 +591,8 @@ describe NewUser::DossiersController, type: :controller do context 'when the dossier has been submitted' do let(:dossier) { create(:dossier, :en_construction, user: user) } - - context 'and the new dossier details page is disabled' do - let(:new_dossier_details_enabled) { false } - it { is_expected.to redirect_to(users_dossier_recapitulatif_path(dossier)) } - end - - context 'and the new dossier details page is enabled' do - let(:new_dossier_details_enabled) { true } - it { expect(assigns(:dossier)).to eq(dossier) } - it { is_expected.to render_template(:show) } - end + it { expect(assigns(:dossier)).to eq(dossier) } + it { is_expected.to render_template(:show) } end end @@ -612,7 +600,6 @@ describe NewUser::DossiersController, type: :controller do let(:dossier) { create(:dossier, :en_construction, user: user) } before do - Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, true) sign_in(user) end diff --git a/spec/features/new_user/dossier_details_spec.rb b/spec/features/new_user/dossier_details_spec.rb index 61218f8be..cf99fed3d 100644 --- a/spec/features/new_user/dossier_details_spec.rb +++ b/spec/features/new_user/dossier_details_spec.rb @@ -6,7 +6,6 @@ describe 'Dossier details:' do let(:dossier) { create(:dossier, :en_construction, :for_individual, :with_commentaires, user: user, procedure: procedure) } before do - Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, true) visit_dossier dossier end diff --git a/spec/features/new_user/invite_spec.rb b/spec/features/new_user/invite_spec.rb index 70d3614f3..60b5cc0f7 100644 --- a/spec/features/new_user/invite_spec.rb +++ b/spec/features/new_user/invite_spec.rb @@ -75,10 +75,6 @@ feature 'Invitations' do context 'when the dossier is en_construction' do let!(:dossier) { create(:dossier, :for_individual, :en_construction, user: owner, procedure: procedure) } - before do - Flipflop::FeatureSet.current.test!.switch!(:new_dossier_details, true) - end - scenario 'on dossier details, the owner of a dossier can invite another user to collaborate on the dossier', js: true do log_in(owner) navigate_to_dossier(dossier) @@ -101,47 +97,6 @@ feature 'Invitations' do end end - 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) - - legacy_send_invite_to "user_invite@exemple.fr" - - expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier)) - expect(page).to have_text("Une invitation a été envoyée à user_invite@exemple.fr.") - expect(page).to have_text("user_invite@exemple.fr") - end - - scenario 'an invited user can see and edit the dossier', js: true do - visit users_dossiers_invite_path(invite) - expect(page).to have_current_path(new_user_session_path) - - submit_login_form(invited_user.email, invited_user.password) - expect(page).to have_current_path(users_dossiers_invite_path(invite)) - expect(page).to have_no_selector('.button.invite-user-action') - expect(page).to have_text("Dossier nº #{dossier.id}") - - # We should be able to just click() the link, but Capybara detects that the - # enclosing div would be clicked instead. - expect(page).to have_link("MODIFIER", href: brouillon_dossier_path(dossier)) - visit brouillon_dossier_path(dossier) - - expect(page).to have_current_path(brouillon_dossier_path(dossier)) - fill_in "Texte obligatoire", with: "Some edited value" - click_button "Enregistrer les modifications du dossier" - - expect(page).to have_current_path(users_dossiers_invite_path(invite)) - expect(page).to have_text("Some edited value") - end - end - private def log_in(user) @@ -175,12 +130,6 @@ feature 'Invitations' do submit_login_form(invited_user.email, invited_user.password) end - def navigate_to_recapitulatif(dossier) - expect(page).to have_current_path(dossiers_path) - click_on(dossier.id) - expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier)) - end - def send_invite_to(invited_email) click_on "Inviter une personne à modifier ce dossier" expect(page).to have_button("Envoyer une invitation", visible: true) @@ -188,15 +137,4 @@ feature 'Invitations' do fill_in 'invite_email', with: invited_email click_on "Envoyer une invitation" end - - def legacy_send_invite_to(invited_email) - find('.dropdown-toggle', text: "Voir les personnes impliquées").click() - expect(page).to have_button("Ajouter", visible: true) - - fill_in 'invite_email', with: invited_email - - page.accept_alert "Envoyer l'invitation ?" do - click_on "Ajouter" - end - end end diff --git a/spec/features/users/flux_de_commentaires_spec.rb b/spec/features/users/flux_de_commentaires_spec.rb deleted file mode 100644 index 12b7ec552..000000000 --- a/spec/features/users/flux_de_commentaires_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'spec_helper' - -feature 'users: flux de commentaires' do - let(:user) { create(:user) } - let(:dossier) { create(:dossier, :with_entreprise, user: user, state: Dossier.states.fetch(:en_construction)) } - let(:dossier_id) { dossier.id } - - let(:champ1) { dossier.champs.first } - let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ, libelle: "subtitle")) } - - let!(:commentaire1) { create(:commentaire, dossier: dossier, champ: champ1) } - let!(:commentaire2) { create(:commentaire, dossier: dossier, email: 'paul.chavard@beta.gouv.fr') } - let!(:commentaire3) { create(:commentaire, dossier: dossier, champ: champ2) } - 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 - - scenario "seuls les commentaires généraux sont affichés" do - comments = find(".commentaires") - expect(comments).to have_selector(".content", count: 1) - expect(comments).to have_content('paul.chavard') - expect(comments).not_to have_content('paul.chavard@beta.gouv.fr') - end -end