Adding launchy to put save_and_open_page in capybara specs, fixing many red tests by removing/changing expectations according to new UI. Need to pursue on spec/features/backoffice/flux_de_commentaires_spec.rb (not priority), and spec/controllers/root_controller_spec.rb (unkonw)

This commit is contained in:
JC 2016-12-13 16:10:03 +01:00
parent dff90d2cf7
commit 22a59123c1
21 changed files with 32 additions and 357 deletions

View file

@ -96,6 +96,7 @@ gem 'browser'
group :test do group :test do
gem 'capybara' gem 'capybara'
gem 'launchy'
gem 'factory_girl' gem 'factory_girl'
gem 'database_cleaner' gem 'database_cleaner'
gem 'selenium-webdriver' gem 'selenium-webdriver'

View file

@ -344,6 +344,8 @@ GEM
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
kgio (2.10.0) kgio (2.10.0)
launchy (2.4.3)
addressable (~> 2.3)
leaflet-draw-rails (0.1.0) leaflet-draw-rails (0.1.0)
leaflet-markercluster-rails (0.7.0) leaflet-markercluster-rails (0.7.0)
railties (>= 3.1) railties (>= 3.1)
@ -657,6 +659,7 @@ DEPENDENCIES
hashie hashie
jbuilder (~> 2.0) jbuilder (~> 2.0)
jquery-rails jquery-rails
launchy
leaflet-draw-rails leaflet-draw-rails
leaflet-markercluster-rails (~> 0.7.0) leaflet-markercluster-rails (~> 0.7.0)
leaflet-rails leaflet-rails

View file

@ -24,4 +24,4 @@ class RootController < ApplicationController
render 'landing' render 'landing'
end end
end end
end end

View file

@ -19,4 +19,4 @@ describe BackofficeController, type: :controller do
it { expect(response).to redirect_to :backoffice_dossiers } it { expect(response).to redirect_to :backoffice_dossiers }
end end
end end
end end

View file

@ -25,14 +25,15 @@ feature 'Administrator connection' do
end end
scenario 'it displays the menu' do scenario 'it displays the menu' do
expect(page).to have_css('a#profile') expect(page).to have_css('a#profile')
expect(page).to have_css('a#admin_sign_out') expect(page).to have_css('#sign_out')
expect(page).to have_css('a.fa-sign-out')
end end
context 'when clicking on sign_out' do context 'when clicking on sign_out' do
before do before do
stub_request(:get, "https://api.github.com/repos/sgmap/tps/releases/latest"). stub_request(:get, "https://api.github.com/repos/sgmap/tps/releases/latest").
to_return(:status => 200, :body => '{"tag_name": "plip", "body": "blabla", "published_at": "2016-02-09T16:46:47Z"}', :headers => {}) to_return(:status => 200, :body => '{"tag_name": "plip", "body": "blabla", "published_at": "2016-02-09T16:46:47Z"}', :headers => {})
page.find_by_id('admin_sign_out').click page.find_by_id('sign_out').find('a.fa-sign-out').click
end end
scenario 'admin is redireted to home page' do scenario 'admin is redireted to home page' do
expect(page).to have_css('#landing') expect(page).to have_css('#landing')
@ -52,7 +53,7 @@ feature 'Administrator connection' do
end end
scenario 'it redirects to procedure page' do scenario 'it redirects to procedure page' do
expect(page).to have_content('Gestion des procédures') expect(page).to have_content('Procédures')
end end
end end
end end

View file

@ -14,20 +14,6 @@ feature 'add commentaire on backoffice' do
visit backoffice_dossier_path(dossier) visit backoffice_dossier_path(dossier)
end end
context 'Affichage du flux de commentaire' do
scenario 'l\'email du contact est présent' do
expect(page).to have_selector('span[id=email_contact]')
end
scenario 'la date du commentaire est présent' do
expect(page).to have_selector('span[id=created_at]')
end
scenario 'le corps du commentaire est présent' do
expect(page).to have_selector('div[class=description][id=body]')
end
end
context 'Affichage du formulaire de commentaire' do context 'Affichage du formulaire de commentaire' do
scenario 'Le formulaire envoie vers /dossiers/:dossier_id/commentaire en #POST' do scenario 'Le formulaire envoie vers /dossiers/:dossier_id/commentaire en #POST' do
expect(page).to have_selector("form[action='/backoffice/commentaires?dossier_id=#{dossier_id}'][method=post]") expect(page).to have_selector("form[action='/backoffice/commentaires?dossier_id=#{dossier_id}'][method=post]")

View file

@ -24,6 +24,7 @@ feature 'when gestionnaire come to /backoffice and is not authenticated' do
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) } let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
before do before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
page.find_by_id(:gestionnaire_email).set gestionnaire.email page.find_by_id(:gestionnaire_email).set gestionnaire.email
page.find_by_id(:gestionnaire_password).set gestionnaire.password page.find_by_id(:gestionnaire_password).set gestionnaire.password
page.click_on 'Se connecter' page.click_on 'Se connecter'
@ -32,4 +33,4 @@ feature 'when gestionnaire come to /backoffice and is not authenticated' do
expect(page).to have_css('#backoffice_index') expect(page).to have_css('#backoffice_index')
end end
end end
end end

View file

@ -50,11 +50,6 @@ feature 'usage of pref list dossier lateral panel', js: true do
expect(page).to have_css('#delete_pref_list_entreprise_siren') expect(page).to have_css('#delete_pref_list_entreprise_siren')
end end
scenario 'dossier is brought up to date' do
wait_for_ajax
expect(page).to have_selector("a.sortable[data-attr='entreprise.siren']")
end
context 'when on click on delete attribut button' do context 'when on click on delete attribut button' do
before do before do
page.click_on 'delete_pref_list_entreprise_siren' page.click_on 'delete_pref_list_entreprise_siren'
@ -69,18 +64,8 @@ feature 'usage of pref list dossier lateral panel', js: true do
wait_for_ajax wait_for_ajax
expect(page).not_to have_selector("a.sortable[data-attr='entreprise.siren']") expect(page).not_to have_selector("a.sortable[data-attr='entreprise.siren']")
end end
context 'when on click on close pref list button' do
before do
page.click_on 'pref_list_dossier_close_action'
end
scenario 'lateral panel is masked' do
expect(page).to have_css('#pref_list_menu', visible: false)
end
end
end end
end end
end end
end end
end end

View file

@ -4,7 +4,6 @@ feature 'on backoffice page' do
let(:administrateur) { create(:administrateur) } let(:administrateur) { create(:administrateur) }
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) } let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
let(:procedure) { create(:procedure, administrateur: administrateur) } let(:procedure) { create(:procedure, administrateur: administrateur) }
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') } let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
before do before do
@ -14,6 +13,7 @@ feature 'on backoffice page' do
end end
context 'when gestionnaire is logged in' do context 'when gestionnaire is logged in' do
before do before do
page.find_by_id(:gestionnaire_email).set gestionnaire.email page.find_by_id(:gestionnaire_email).set gestionnaire.email
page.find_by_id(:gestionnaire_password).set gestionnaire.password page.find_by_id(:gestionnaire_password).set gestionnaire.password
@ -21,7 +21,9 @@ feature 'on backoffice page' do
page.click_on 'Se connecter' page.click_on 'Se connecter'
end end
context 'when he click on first dossier', js: true do context 'when he click on first dossier', js: true do
before do before do
page.find("#all_dossiers").click
page.find("#tr_dossier_#{dossier.id}").click page.find("#tr_dossier_#{dossier.id}").click
end end
@ -29,21 +31,5 @@ feature 'on backoffice page' do
expect(page).to have_css('#backoffice_dossier_show') expect(page).to have_css('#backoffice_dossier_show')
end end
end end
context 'when gestionnaire have enterprise and individual dossier in his inbox', js: true do
let!(:procedure_individual) { create :procedure, libelle: 'procedure individual', administrateur: administrateur, for_individual: true }
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'updated' }
before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_individual
visit backoffice_path
page.find("#tr_dossier_#{dossier_individual.id}").click
end
scenario 'it redirect to dossier page' do
expect(page).to have_css('#backoffice_dossier_show')
end
end
end end
end end

View file

@ -1,103 +0,0 @@
require 'spec_helper'
feature 'on click on tabs button' do
let(:administrateur) { create(:administrateur) }
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
let(:procedure) { create :procedure, administrateur: administrateur }
before do
create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated')
create(:dossier, :with_entreprise, procedure: procedure, state: 'replied')
create(:dossier, :with_entreprise, procedure: procedure, state: 'updated')
create(:dossier, :with_entreprise, procedure: procedure, state: 'validated')
create(:dossier, :with_entreprise, procedure: procedure, state: 'submitted')
create(:dossier, :with_entreprise, procedure: procedure, state: 'received')
create(:dossier, :with_entreprise, procedure: procedure, state: 'closed')
create(:dossier, :with_entreprise, procedure: procedure, state: 'refused')
create(:dossier, :with_entreprise, procedure: procedure, state: 'without_continuation')
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
login_as gestionnaire, scope: :gestionnaire
end
context 'when gestionnaire is logged in' do
context 'when he click on tabs nouveaux' do
before do
visit backoffice_dossiers_url(liste: :nouveaux)
page.click_on 'Nouveaux 1'
end
scenario 'it redirect to backoffice dossier termine' do
expect(page).to have_css('#backoffice_index')
end
end
context 'when he click on tabs a traite' do
before do
visit backoffice_dossiers_url(liste: :a_traiter)
page.click_on 'Ouverts 2'
end
scenario 'it redirect to backoffice dossier termine' do
expect(page).to have_css('#backoffice_index')
end
end
context 'when he click on tabs en attente' do
before do
visit backoffice_dossiers_url(liste: :figes)
page.click_on 'Figés 1'
end
scenario 'it redirect to backoffice dossier en attente' do
expect(page).to have_css('#backoffice_index')
end
end
context 'when he click on tabs a receptionner' do
before do
visit backoffice_dossiers_url(liste: :deposes)
page.click_on 'À réceptionner 1'
end
scenario 'it redirect to backoffice dossier a_receptionner' do
expect(page).to have_css('#backoffice_index')
end
end
context 'when he click on tabs a instruire' do
before do
visit backoffice_dossiers_url(liste: :a_instruire)
page.click_on 'À instruire 1'
end
scenario 'it redirect to backoffice dossier termine' do
expect(page).to have_css('#backoffice_index')
end
end
context 'when he click on tabs termine' do
before do
visit backoffice_dossiers_url(liste: :termine)
page.click_on 'Terminé 3'
end
scenario 'it redirect to backoffice dossier termine' do
expect(page).to have_css('#backoffice_index')
end
end
end
context "OpenSimplif" do
before do
allow(Features).to receive(:opensimplif).and_return(true)
visit backoffice_dossiers_url
end
scenario "it hides the tabs" do
expect(page).to_not have_content('Nouveaux')
end
end
end

View file

@ -62,7 +62,7 @@ feature 'France Connect Particulier Connexion' do
end end
scenario 'he is redirected to user dossiers page' do scenario 'he is redirected to user dossiers page' do
expect(page).to have_content('Mes dossiers') expect(page).to have_content('Dossiers')
end end
end end
end end
@ -74,7 +74,7 @@ feature 'France Connect Particulier Connexion' do
end end
scenario 'he is redirected to user dossiers page' do scenario 'he is redirected to user dossiers page' do
expect(page).to have_content('Mes dossiers') expect(page).to have_content('Dossiers')
end end
end end
end end
@ -96,4 +96,4 @@ feature 'France Connect Particulier Connexion' do
end end
end end
end end
end end

View file

@ -71,9 +71,6 @@ feature 'user path for dossier creation' do
page.find_by_id("champs_#{Dossier.last.champs.first.id}").set 'Mon super projet' page.find_by_id("champs_#{Dossier.last.champs.first.id}").set 'Mon super projet'
page.click_on 'Soumettre mon dossier' page.click_on 'Soumettre mon dossier'
end end
scenario 'user is on recap page' do
expect(page).to have_css('#recap_dossier')
end
end end
end end
end end
@ -90,4 +87,4 @@ feature 'user path for dossier creation' do
expect(page).to have_content('La procédure n\'existe pas') expect(page).to have_content('La procédure n\'existe pas')
end end
end end
end end

View file

@ -37,7 +37,7 @@ feature 'user access to the list of his dossier' do
page.find("#tr_dossier_#{dossier1.id}").click page.find("#tr_dossier_#{dossier1.id}").click
end end
scenario 'user is redirected to dossier page' do scenario 'user is redirected to dossier page' do
expect(page).to have_css('#recap_dossier') expect(page).to have_css('#users_recapitulatif_dossier_show')
end end
end end
end end

View file

@ -79,13 +79,11 @@ describe 'admin/previsualisations/show.html.haml', type: :view do
describe 'first champs' do describe 'first champs' do
subject { dossier.champs.first } subject { dossier.champs.first }
it { expect(rendered).to have_css(".type_champ-#{subject.type_champ}") }
it { expect(rendered).to have_css("#champs_#{subject.id}") } it { expect(rendered).to have_css("#champs_#{subject.id}") }
end end
describe 'last champs' do describe 'last champs' do
subject { dossier.champs.last } subject { dossier.champs.last }
it { expect(rendered).to have_css(".type_champ-#{subject.type_champ}") }
it { expect(rendered).to have_css("#champs_#{subject.id}") } it { expect(rendered).to have_css("#champs_#{subject.id}") }
end end
end end

View file

@ -23,16 +23,7 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
expect(rendered).not_to have_css('#UploadPJmodal') expect(rendered).not_to have_css('#UploadPJmodal')
end end
it 'enterprise informations are present' do
expect(rendered).to have_selector('#infos_entreprise')
end
it 'dossier informations are present' do
expect(rendered).to have_selector('#infos_dossier')
end
it 'dossier number is present' do it 'dossier number is present' do
expect(rendered).to have_selector('#dossier_id')
expect(rendered).to have_content(dossier_id) expect(rendered).to have_content(dossier_id)
end end
@ -52,50 +43,6 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
end end
context 'dossier state changements' do context 'dossier state changements' do
context 'when dossier have state initiated' do
let(:state) { 'initiated' }
before do
render
end
it { expect(rendered).to have_content('Nouveau') }
it 'button Déclarer complet is present' do
expect(rendered).to have_css('.action_button')
expect(rendered).to have_content('Déclarer complet')
end
end
context 'when dossier have state replied' do
let(:state) { 'replied' }
before do
render
end
it { expect(rendered).to have_content('Répondu') }
it 'button Déclarer complet is present' do
expect(rendered).to have_css('.action_button')
expect(rendered).to have_content('Déclarer complet')
end
end
context 'when dossier have state update' do
let(:state) { 'updated' }
before do
render
end
it { expect(rendered).to have_content('Mis à jour') }
it 'button Déclarer complet is present' do
expect(rendered).to have_css('.action_button')
expect(rendered).to have_content('Déclarer complet')
end
end
context 'when dossier have state validated' do context 'when dossier have state validated' do
let(:state) { 'validated' } let(:state) { 'validated' }
@ -104,49 +51,11 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
render render
end end
it { expect(rendered).to have_content('Figé') }
it 'button Déclarer complet is not present' do it 'button Déclarer complet is not present' do
expect(rendered).not_to have_css('.action_button')
expect(rendered).not_to have_content('Déclarer complet') expect(rendered).not_to have_content('Déclarer complet')
end end
end end
context 'when dossier have state submitted' do
let(:state) { 'submitted' }
before do
render
end
it { expect(rendered).to have_content('Déposé') }
it 'button Accuser réception is present' do
expect(rendered).to have_css('.action_button')
expect(rendered).to have_content('Accuser réception')
end
it 'button Déclarer complet is not present' do
expect(rendered).not_to have_content('Accepter le dossier')
end
end
context 'when dossier have state received' do
let(:state) { 'received' }
before do
render
end
it { expect(rendered).to have_content('Reçu') }
it 'button accepter / refuser / classer sans suite are present' do
expect(rendered).to have_css('.action_button[data-toggle="tooltip"][title="Accepter"]')
expect(rendered).to have_css('.action_button[data-toggle="tooltip"][title="Classer sans suite"]')
expect(rendered).to have_css('.action_button[data-toggle="tooltip"][title="Refuser"]')
end
end
context 'when dossier have state closed' do context 'when dossier have state closed' do
let(:state) { 'closed' } let(:state) { 'closed' }
@ -154,8 +63,6 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
render render
end end
it { expect(rendered).to have_content('Accepté') }
it 'button Accepter le dossier is not present' do it 'button Accepter le dossier is not present' do
expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Accepter"]') expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Accepter"]')
expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Classer sans suite"]') expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Classer sans suite"]')
@ -170,8 +77,6 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
render render
end end
it { expect(rendered).to have_content('Sans suite') }
it 'button Déclarer complet is not present' do it 'button Déclarer complet is not present' do
expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Accepter"]') expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Accepter"]')
expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Classer sans suite"]') expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Classer sans suite"]')
@ -186,8 +91,6 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
render render
end end
it { expect(rendered).to have_content('Refusé') }
it 'button Déclarer complet is not present' do it 'button Déclarer complet is not present' do
expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Accepter"]') expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Accepter"]')
expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Classer sans suite"]') expect(rendered).not_to have_css('.action_button[data-toggle="tooltip"][title="Classer sans suite"]')

View file

@ -21,9 +21,5 @@ describe 'dossiers/_infos_dossier.html.haml', type: :view do
it { expect(rendered).to have_content(champs.last.libelle) } it { expect(rendered).to have_content(champs.last.libelle) }
it { expect(rendered).to have_content(champs.last.value) } it { expect(rendered).to have_content(champs.last.value) }
context 'when api carto is used' do
it { expect(rendered).to have_css('#map') }
end
end end
end end

View file

@ -13,12 +13,10 @@ describe 'layouts/_navbar.html.haml', type: :view do
render render
end end
subject { rendered } subject { rendered }
it { is_expected.to match(/href="\/users\/sign_in">Utilisateur/) } it { is_expected.not_to match(/href="\/users\/sign_in">Utilisateur/) }
it { is_expected.to match(/href="\/gestionnaires\/sign_in">Accompagnateur/) } it { is_expected.to match(/href="\/gestionnaires\/sign_in">Accompagnateur/) }
it { is_expected.to match(/href="\/administrateurs\/sign_in">Administrateur/) } it { is_expected.not_to match(/href="\/administrateurs\/sign_in">Administrateur/) }
it { is_expected.not_to match(/Mes Dossiers/) } it { is_expected.to match(/Connexion/) }
it { is_expected.not_to match(/Mes Procédures/) }
it { is_expected.not_to match(/Se déconnecter/) }
end end
context 'when administrateur is connected' do context 'when administrateur is connected' do
@ -33,9 +31,7 @@ describe 'layouts/_navbar.html.haml', type: :view do
it { is_expected.not_to match(/href="\/users\/sign_in">Utilisateur/) } it { is_expected.not_to match(/href="\/users\/sign_in">Utilisateur/) }
it { is_expected.not_to match(/href="\/gestionnaires\/sign_in">Accompagnateur/) } it { is_expected.not_to match(/href="\/gestionnaires\/sign_in">Accompagnateur/) }
it { is_expected.not_to match(/href="\/administrateurs\/sign_in">Administrateur/) } it { is_expected.not_to match(/href="\/administrateurs\/sign_in">Administrateur/) }
it { is_expected.not_to match(/Mes dossiers/) } it { is_expected.to match(/Déconnexion/) }
it { is_expected.to match(/Mes procédures/) }
it { is_expected.to match(/Se déconnecter/) }
end end
context 'when gestionnaire is connected' do context 'when gestionnaire is connected' do
@ -50,8 +46,6 @@ describe 'layouts/_navbar.html.haml', type: :view do
it { is_expected.not_to match(/href="\/users\/sign_in">Utilisateur/) } it { is_expected.not_to match(/href="\/users\/sign_in">Utilisateur/) }
it { is_expected.not_to match(/href="\/gestionnaires\/sign_in">Accompagnateur/) } it { is_expected.not_to match(/href="\/gestionnaires\/sign_in">Accompagnateur/) }
it { is_expected.not_to match(/href="\/administrateurs\/sign_in">Administrateur/) } it { is_expected.not_to match(/href="\/administrateurs\/sign_in">Administrateur/) }
it { is_expected.not_to match(/Mes procédures/) }
it { is_expected.to match(/Mes dossiers/) }
it { is_expected.to match(/Déconnexion/) } it { is_expected.to match(/Déconnexion/) }
end end

View file

@ -73,13 +73,11 @@ describe 'users/description/show.html.haml', type: :view do
describe 'first champs' do describe 'first champs' do
subject { dossier.champs.first } subject { dossier.champs.first }
it { expect(rendered).to have_css(".type_champ-#{subject.type_champ}") }
it { expect(rendered).to have_css("#champs_#{subject.id}") } it { expect(rendered).to have_css("#champs_#{subject.id}") }
end end
describe 'last champs' do describe 'last champs' do
subject { dossier.champs.last } subject { dossier.champs.last }
it { expect(rendered).to have_css(".type_champ-#{subject.type_champ}") }
it { expect(rendered).to have_css("#champs_#{subject.id}") } it { expect(rendered).to have_css("#champs_#{subject.id}") }
end end

View file

@ -40,10 +40,6 @@ describe 'users/dossiers/index.html.haml', type: :view do
end end
it { expect(dossiers_to_display.count).to eq total_dossiers } it { expect(dossiers_to_display.count).to eq total_dossiers }
describe 'active tab' do
it { is_expected.to have_selector(active_class) }
end
end end
describe 'on tab en construction' do describe 'on tab en construction' do
@ -120,4 +116,4 @@ describe 'users/dossiers/index.html.haml', type: :view do
let(:decorate_dossier_at_check) { decorate_dossier_invite } let(:decorate_dossier_at_check) { decorate_dossier_invite }
end end
end end
end end

View file

@ -35,20 +35,4 @@ describe 'users/recapitulatif/_commentaires_flux.html.haml', type: :view, vcr: {
end end
end end
end end
context 'Affichage du formulaire de commentaire' do
it 'Le formulaire envoie vers /dossiers/:dossier_id/commentaire en #POST' do
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/commentaire'][method=post]")
end
it 'Champs de texte' do
expect(rendered).to have_selector('textarea[id=texte_commentaire][name=texte_commentaire]')
end
describe 'File input' do
it 'have file_input tag' do
expect(rendered).to have_css('#piece_justificative_content')
end
end
end
end end

View file

@ -17,15 +17,10 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
end end
it 'la section infos dossier est présente' do it 'la section infos dossier est présente' do
expect(rendered).to have_selector('#infos_dossier') expect(rendered).to have_selector('#dossier')
end
it 'le flux de commentaire est présent' do
expect(rendered).to have_selector('#commentaires_flux')
end end
it 'le numéro de dossier est présent' do it 'le numéro de dossier est présent' do
expect(rendered).to have_selector('#dossier_id')
expect(rendered).to have_content(dossier_id) expect(rendered).to have_content(dossier_id)
end end
@ -40,27 +35,17 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
end end
end end
context 'lien carte' do context 'lien mise à jour pj' do
it 'le lien vers carte est présent' do it 'le lien vers la mise à jour des pj est présent' do
expect(rendered).to have_css('#maj_pj') expect(rendered).to have_css('#maj_pj')
end end
end end
context 'lien carte' do context 'lien siret' do
it 'le lien vers le renseignement un SIRET est présent' do it 'le lien vers le renseignement un SIRET est présent' do
expect(rendered).to have_css('#add_siret') expect(rendered).to have_css('#add_siret')
end end
end end
context 'lien carte' do
it 'le lien vers carte est présent' do
expect(rendered).to have_css('#maj_carte')
end
it 'le lien vers description est correct' do
expect(rendered).to have_selector("a[id=maj_carte][href='/users/dossiers/#{dossier_id}/carte']")
end
end
end end
end end
@ -71,8 +56,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
render render
end end
it { expect(rendered).to have_content('Nouveau') }
it 'button Modifier les document est present' do it 'button Modifier les document est present' do
expect(rendered).to have_content('Modifier les documents') expect(rendered).to have_content('Modifier les documents')
expect(rendered).to have_css('#UploadPJmodal') expect(rendered).to have_css('#UploadPJmodal')
@ -80,26 +63,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
end end
context 'when dossier state is replied' do
let(:state) { 'replied' }
before do
render
end
it { expect(rendered).to have_content('Répondu') }
end
context 'when dossier state is updated' do
let(:state) { 'updated' }
before do
render
end
it { expect(rendered).to have_content('Mis à jour') }
end
context 'when dossier state is validated' do context 'when dossier state is validated' do
let(:state) { 'validated' } let(:state) { 'validated' }
@ -107,11 +70,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
render render
end end
it 'button Procéder au dépôt définitif est present' do
expect(rendered).to have_css('#validate_button')
expect(rendered).to have_content('Procéder au dépôt définitif')
end
it 'button Editer mon dossier n\'est plus present' do it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos') expect(rendered).not_to have_css('#maj_infos')
expect(rendered).not_to have_content('Modifier mon dossier') expect(rendered).not_to have_content('Modifier mon dossier')
@ -129,8 +87,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
render render
end end
it { expect(rendered).to have_content('Déposé') }
it 'button Editer mon dossier n\'est plus present' do it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos') expect(rendered).not_to have_css('#maj_infos')
expect(rendered).not_to have_content('Modifier mon dossier') expect(rendered).not_to have_content('Modifier mon dossier')
@ -143,7 +99,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
before do before do
render render
end end
it { expect(rendered).to have_content('Accepté') }
it 'button Editer mon dossier n\'est plus present' do it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos') expect(rendered).not_to have_css('#maj_infos')
@ -157,7 +112,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
before do before do
render render
end end
it { expect(rendered).to have_content('Refusé') }
it 'button Editer mon dossier n\'est plus present' do it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos') expect(rendered).not_to have_css('#maj_infos')
@ -171,7 +125,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
before do before do
render render
end end
it { expect(rendered).to have_content('Sans suite') }
it 'button Editer mon dossier n\'est plus present' do it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos') expect(rendered).not_to have_css('#maj_infos')
@ -238,10 +191,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
expect(rendered).to have_css('#maj_infos') expect(rendered).to have_css('#maj_infos')
end end
it 'map link is present' do
expect(rendered).to have_css('#maj_carte')
end
it 'PJ link is present' do it 'PJ link is present' do
expect(rendered).to have_css('#maj_pj') expect(rendered).to have_css('#maj_pj')
end end