Delete default description in dossier
This commit is contained in:
parent
fdee7154cf
commit
866565495d
18 changed files with 75 additions and 56 deletions
|
@ -116,7 +116,7 @@ describe API::V1::DossiersController do
|
|||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||
let(:field_list) { [:id, :nom_projet, :created_at, :updated_at, :description, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :commentaires] }
|
||||
let(:field_list) { [:id, :nom_projet, :created_at, :updated_at, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :commentaires] }
|
||||
subject { body[:dossier] }
|
||||
|
||||
it 'return REST code 200', :show_in_doc do
|
||||
|
@ -126,7 +126,6 @@ describe API::V1::DossiersController do
|
|||
it { expect(subject[:nom_projet]).to eq(dossier.nom_projet) }
|
||||
it { expect(subject[:created_at]).to eq('2008-09-01T08:05:00.000Z') }
|
||||
it { expect(subject[:updated_at]).to eq('2008-09-01T08:05:00.000Z') }
|
||||
it { expect(subject[:description]).to eq(dossier.description) }
|
||||
it { expect(subject[:archived]).to eq(dossier.archived) }
|
||||
it { expect(subject[:mandataire_social]).to eq(dossier.mandataire_social) }
|
||||
|
||||
|
|
|
@ -116,12 +116,6 @@ describe Users::DescriptionController, type: :controller, vcr: { cassette_name:
|
|||
it { is_expected.to render_template(:show) }
|
||||
it { expect(flash[:alert]).to be_present }
|
||||
end
|
||||
|
||||
context 'description empty' do
|
||||
let(:description) { '' }
|
||||
it { is_expected.to render_template(:show) }
|
||||
it { expect(flash[:alert]).to be_present }
|
||||
end
|
||||
end
|
||||
|
||||
context 'Quand la procédure accepte les CERFA' do
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
FactoryGirl.define do
|
||||
factory :dossier do
|
||||
nom_projet "Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger"
|
||||
description "Ma super description"
|
||||
state 'draft'
|
||||
association :user, factory: [:user]
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ feature 'user is on description page' do
|
|||
context 'he fill description fields' do
|
||||
before do
|
||||
find_by_id('nom_projet').set 'mon nom'
|
||||
find_by_id('description').set 'ma description'
|
||||
end
|
||||
context 'before submit' do
|
||||
it 'dossier cerfa is empty' do
|
||||
|
|
|
@ -55,7 +55,6 @@ feature 'user path for dossier creation' do
|
|||
context 'user fill and validate description page' do
|
||||
before do
|
||||
page.find_by_id('nom_projet').set 'Mon super projet'
|
||||
page.find_by_id('description').set 'Ma super description'
|
||||
page.click_on 'Soumettre mon dossier'
|
||||
end
|
||||
scenario 'user is on recap page' do
|
||||
|
|
|
@ -3,7 +3,6 @@ require 'spec_helper'
|
|||
describe Dossier do
|
||||
let(:user) { create(:user) }
|
||||
describe 'database columns' do
|
||||
it { is_expected.to have_db_column(:description) }
|
||||
it { is_expected.to have_db_column(:autorisation_donnees) }
|
||||
it { is_expected.to have_db_column(:nom_projet) }
|
||||
it { is_expected.to have_db_column(:created_at) }
|
||||
|
@ -40,11 +39,6 @@ describe Dossier do
|
|||
it { is_expected.not_to allow_value('').for(:nom_projet) }
|
||||
it { is_expected.to allow_value('mon super projet').for(:nom_projet) }
|
||||
end
|
||||
context 'description' do
|
||||
it { is_expected.to allow_value(nil).for(:description) }
|
||||
it { is_expected.not_to allow_value('').for(:description) }
|
||||
it { is_expected.to allow_value('ma superbe description').for(:description) }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'methods' do
|
||||
|
@ -115,6 +109,7 @@ describe Dossier do
|
|||
describe '#save' do
|
||||
subject { build(:dossier, procedure: procedure, user: user) }
|
||||
let!(:procedure) { create(:procedure) }
|
||||
|
||||
context 'when is linked to a procedure' do
|
||||
it 'creates default champs' do
|
||||
expect(subject).to receive(:build_default_champs)
|
||||
|
@ -122,11 +117,11 @@ describe Dossier do
|
|||
end
|
||||
end
|
||||
context 'when is not linked to a procedure' do
|
||||
subject { create(:dossier, procedure: procedure, user: user) }
|
||||
subject { create(:dossier, procedure: nil, user: user) }
|
||||
|
||||
it 'does not create default champs' do
|
||||
expect(subject).not_to receive(:build_default_champs)
|
||||
subject.update_attributes(description: 'plop')
|
||||
subject.update_attributes(nom_projet: 'plop')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -541,7 +536,6 @@ describe Dossier do
|
|||
subject { dossier.as_csv }
|
||||
|
||||
it { expect(subject[:nom_projet]).to eq("Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger") }
|
||||
it { expect(subject[:description]).to eq("Ma super description") }
|
||||
it { expect(subject[:archived]).to be_falsey }
|
||||
it { expect(subject['etablissement.siret']).to eq('44011762001530') }
|
||||
it { expect(subject['etablissement.siege_social']).to be_truthy }
|
||||
|
|
|
@ -25,10 +25,6 @@ describe 'admin/previsualisations/show.html.haml', type: :view do
|
|||
expect(rendered).to have_selector('input[id=nom_projet][name=nom_projet]')
|
||||
end
|
||||
|
||||
it 'Description du projet' do
|
||||
expect(rendered).to have_selector('textarea[id=description][name=description]')
|
||||
end
|
||||
|
||||
it 'Charger votre CERFA (PDF)' do
|
||||
expect(rendered).to have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]')
|
||||
end
|
||||
|
@ -71,7 +67,6 @@ describe 'admin/previsualisations/show.html.haml', type: :view do
|
|||
let!(:dossier) do
|
||||
create(:dossier,
|
||||
nom_projet: 'Projet de test',
|
||||
description: 'Description de test',
|
||||
user: user)
|
||||
end
|
||||
|
||||
|
@ -82,10 +77,6 @@ describe 'admin/previsualisations/show.html.haml', type: :view do
|
|||
it 'Nom du projet' do
|
||||
expect(rendered).to have_selector("input[id=nom_projet][value='#{dossier.nom_projet}']")
|
||||
end
|
||||
|
||||
it 'Description du projet' do
|
||||
expect(rendered).to have_content("#{dossier.description}")
|
||||
end
|
||||
end
|
||||
|
||||
context 'Champs' do
|
||||
|
|
|
@ -26,10 +26,6 @@ describe 'users/description/show.html.haml', type: :view do
|
|||
expect(rendered).to have_selector('input[id=nom_projet][name=nom_projet]')
|
||||
end
|
||||
|
||||
it 'Description du projet' do
|
||||
expect(rendered).to have_selector('textarea[id=description][name=description]')
|
||||
end
|
||||
|
||||
it 'Charger votre CERFA (PDF)' do
|
||||
expect(rendered).to have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]')
|
||||
end
|
||||
|
@ -72,7 +68,6 @@ describe 'users/description/show.html.haml', type: :view do
|
|||
let!(:dossier) do
|
||||
create(:dossier,
|
||||
nom_projet: 'Projet de test',
|
||||
description: 'Description de test',
|
||||
user: user)
|
||||
end
|
||||
|
||||
|
@ -83,10 +78,6 @@ describe 'users/description/show.html.haml', type: :view do
|
|||
it 'Nom du projet' do
|
||||
expect(rendered).to have_selector("input[id=nom_projet][value='#{dossier.nom_projet}']")
|
||||
end
|
||||
|
||||
it 'Description du projet' do
|
||||
expect(rendered).to have_content("#{dossier.description}")
|
||||
end
|
||||
end
|
||||
|
||||
context 'Champs' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue