refactor(dossier): champs -> champs_public
This commit is contained in:
parent
68e0abc15f
commit
e6288c39f2
62 changed files with 227 additions and 223 deletions
|
@ -467,7 +467,7 @@ describe API::V2::GraphqlController do
|
|||
}
|
||||
end,
|
||||
avis: [],
|
||||
champs: dossier.champs.map do |champ|
|
||||
champs: dossier.champs_public.map do |champ|
|
||||
{
|
||||
id: champ.to_typed_id,
|
||||
label: champ.libelle,
|
||||
|
@ -475,7 +475,7 @@ describe API::V2::GraphqlController do
|
|||
}
|
||||
end
|
||||
})
|
||||
expect(gql_data[:dossier][:champs][0][:id]).to eq(dossier.champs[0].type_de_champ.to_typed_id)
|
||||
expect(gql_data[:dossier][:champs][0][:id]).to eq(dossier.champs_public[0].type_de_champ.to_typed_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -606,8 +606,8 @@ describe API::V2::GraphqlController do
|
|||
context "champs" do
|
||||
let(:procedure) { create(:procedure, :published, :for_individual, administrateurs: [admin], types_de_champ_public: [{ type: :date }, { type: :datetime }]) }
|
||||
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
let(:champ_date) { dossier.champs.first }
|
||||
let(:champ_datetime) { dossier.champs.second }
|
||||
let(:champ_date) { dossier.champs_public.first }
|
||||
let(:champ_datetime) { dossier.champs_public.second }
|
||||
|
||||
before do
|
||||
champ_date.update(value: '2019-07-10')
|
||||
|
|
|
@ -5,7 +5,7 @@ describe Champs::CarteController, type: :controller do
|
|||
let(:params) do
|
||||
{
|
||||
dossier: {
|
||||
champs_attributes: {
|
||||
champs_public_attributes: {
|
||||
'1' => { value: value }
|
||||
}
|
||||
},
|
||||
|
|
|
@ -4,13 +4,13 @@ describe Champs::DossierLinkController, type: :controller do
|
|||
|
||||
describe '#show' do
|
||||
let(:dossier) { create(:dossier, user: user, procedure: procedure) }
|
||||
let(:champ) { dossier.champs.first }
|
||||
let(:champ) { dossier.champs_public.first }
|
||||
|
||||
context 'when user is connected' do
|
||||
render_views
|
||||
before { sign_in user }
|
||||
|
||||
let(:champs_attributes) do
|
||||
let(:champs_public_attributes) do
|
||||
champ_attributes = []
|
||||
champ_attributes[champ.id] = { value: dossier_id }
|
||||
champ_attributes
|
||||
|
@ -19,7 +19,7 @@ describe Champs::DossierLinkController, type: :controller do
|
|||
{
|
||||
champ_id: champ.id,
|
||||
dossier: {
|
||||
champs_attributes: champs_attributes
|
||||
champs_public_attributes: champs_public_attributes
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ describe Champs::PieceJustificativeController, type: :controller do
|
|||
let(:user) { create(:user) }
|
||||
let(:procedure) { create(:procedure, :published, :with_piece_justificative) }
|
||||
let(:dossier) { create(:dossier, user: user, procedure: procedure) }
|
||||
let(:champ) { dossier.champs.first }
|
||||
let(:champ) { dossier.champs_public.first }
|
||||
|
||||
describe '#update' do
|
||||
render_views
|
||||
|
|
|
@ -4,9 +4,9 @@ describe Champs::RNAController, type: :controller do
|
|||
|
||||
describe '#show' do
|
||||
let(:dossier) { create(:dossier, user: user, procedure: procedure) }
|
||||
let(:champ) { dossier.champs.first }
|
||||
let(:champ) { dossier.champs_public.first }
|
||||
|
||||
let(:champs_attributes) do
|
||||
let(:champs_public_attributes) do
|
||||
champ_attributes = []
|
||||
champ_attributes[champ.id] = { value: rna }
|
||||
champ_attributes
|
||||
|
@ -15,7 +15,7 @@ describe Champs::RNAController, type: :controller do
|
|||
{
|
||||
champ_id: champ.id,
|
||||
dossier: {
|
||||
champs_attributes: champs_attributes
|
||||
champs_public_attributes: champs_public_attributes
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
@ -4,9 +4,9 @@ describe Champs::SiretController, type: :controller do
|
|||
|
||||
describe '#show' do
|
||||
let(:dossier) { create(:dossier, user: user, procedure: procedure) }
|
||||
let(:champ) { dossier.champs.first }
|
||||
let(:champ) { dossier.champs_public.first }
|
||||
|
||||
let(:champs_attributes) do
|
||||
let(:champs_public_attributes) do
|
||||
champ_attributes = []
|
||||
champ_attributes[champ.id] = { value: siret }
|
||||
champ_attributes
|
||||
|
@ -15,7 +15,7 @@ describe Champs::SiretController, type: :controller do
|
|||
{
|
||||
champ_id: champ.id,
|
||||
dossier: {
|
||||
champs_attributes: champs_attributes
|
||||
champs_public_attributes: champs_public_attributes
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
@ -368,7 +368,7 @@ describe Experts::AvisController, type: :controller do
|
|||
context 'when the expert also shares the linked dossiers' do
|
||||
context 'and the expert can access the linked dossiers' do
|
||||
let(:created_avis) { create(:avis, dossier: dossier, claimant: claimant, email: "toto3@gmail.com") }
|
||||
let(:linked_dossier) { Dossier.find_by(id: dossier.reload.champs.filter(&:dossier_link?).filter_map(&:value)) }
|
||||
let(:linked_dossier) { Dossier.find_by(id: dossier.reload.champs_public.filter(&:dossier_link?).filter_map(&:value)) }
|
||||
let(:linked_avis) { create(:avis, dossier: linked_dossier, claimant: claimant) }
|
||||
let(:invite_linked_dossiers) { true }
|
||||
|
||||
|
|
|
@ -591,7 +591,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
|||
context 'and the expert can access the linked dossiers' do
|
||||
let(:saved_avis) { Avis.last(2).first }
|
||||
let(:linked_avis) { Avis.last }
|
||||
let(:linked_dossier) { Dossier.find_by(id: dossier.reload.champs.filter(&:dossier_link?).filter_map(&:value)) }
|
||||
let(:linked_dossier) { Dossier.find_by(id: dossier.reload.champs_public.filter(&:dossier_link?).filter_map(&:value)) }
|
||||
let(:invite_linked_dossiers) do
|
||||
instructeur.assign_to_procedure(linked_dossier.procedure)
|
||||
true
|
||||
|
@ -763,7 +763,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
|||
dossier_id: dossier.id,
|
||||
dossier: {
|
||||
champs_private_attributes: {},
|
||||
champs_attributes: {
|
||||
champs_public_attributes: {
|
||||
'0': {
|
||||
id: champ_multiple_drop_down_list.id,
|
||||
value: ['', 'un', 'deux']
|
||||
|
|
|
@ -19,14 +19,14 @@ describe RechercheController, type: :controller do
|
|||
before do
|
||||
instructeur.assign_to_procedure(dossier.procedure)
|
||||
|
||||
dossier.champs[0].value = "Name of district A"
|
||||
dossier.champs[1].value = "Name of city A"
|
||||
dossier.champs_public[0].value = "Name of district A"
|
||||
dossier.champs_public[1].value = "Name of city A"
|
||||
dossier.champs_private[0].value = "Dossier A is complete"
|
||||
dossier.champs_private[1].value = "Dossier A is valid"
|
||||
dossier.save!
|
||||
|
||||
dossier_with_expert.champs[0].value = "Name of district B"
|
||||
dossier_with_expert.champs[1].value = "name of city B"
|
||||
dossier_with_expert.champs_public[0].value = "Name of district B"
|
||||
dossier_with_expert.champs_public[1].value = "name of city B"
|
||||
dossier_with_expert.champs_private[0].value = "Dossier B is incomplete"
|
||||
dossier_with_expert.champs_private[1].value = "Dossier B is invalid"
|
||||
dossier_with_expert.save!
|
||||
|
|
|
@ -342,7 +342,7 @@ describe Users::DossiersController, type: :controller do
|
|||
before { sign_in(user) }
|
||||
|
||||
let!(:dossier) { create(:dossier, user: user) }
|
||||
let(:first_champ) { dossier.champs.first }
|
||||
let(:first_champ) { dossier.champs_public.first }
|
||||
let(:value) { 'beautiful value' }
|
||||
let(:now) { Time.zone.parse('01/01/2100') }
|
||||
let(:payload) { { id: dossier.id } }
|
||||
|
@ -437,8 +437,8 @@ describe Users::DossiersController, type: :controller do
|
|||
|
||||
let(:procedure) { create(:procedure, :published, :with_type_de_champ, :with_piece_justificative) }
|
||||
let!(:dossier) { create(:dossier, user: user, procedure: procedure) }
|
||||
let(:first_champ) { dossier.champs.first }
|
||||
let(:piece_justificative_champ) { dossier.champs.last }
|
||||
let(:first_champ) { dossier.champs_public.first }
|
||||
let(:piece_justificative_champ) { dossier.champs_public.last }
|
||||
let(:value) { 'beautiful value' }
|
||||
let(:file) { fixture_file_upload('spec/fixtures/files/piece_justificative_0.pdf', 'application/pdf') }
|
||||
let(:now) { Time.zone.parse('01/01/2100') }
|
||||
|
@ -448,7 +448,7 @@ describe Users::DossiersController, type: :controller do
|
|||
id: dossier.id,
|
||||
dossier: {
|
||||
groupe_instructeur_id: dossier.groupe_instructeur_id,
|
||||
champs_attributes: [
|
||||
champs_public_attributes: [
|
||||
{
|
||||
id: first_champ.id,
|
||||
value: value
|
||||
|
@ -494,7 +494,7 @@ describe Users::DossiersController, type: :controller do
|
|||
{
|
||||
id: dossier.id,
|
||||
dossier: {
|
||||
champs_attributes: {}
|
||||
champs_public_attributes: {}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
@ -532,8 +532,8 @@ describe Users::DossiersController, type: :controller do
|
|||
|
||||
let(:procedure) { create(:procedure, :published, :with_type_de_champ, :with_piece_justificative) }
|
||||
let!(:dossier) { create(:dossier, :en_construction, user: user, procedure: procedure) }
|
||||
let(:first_champ) { dossier.champs.first }
|
||||
let(:piece_justificative_champ) { dossier.champs.last }
|
||||
let(:first_champ) { dossier.champs_public.first }
|
||||
let(:piece_justificative_champ) { dossier.champs_public.last }
|
||||
let(:value) { 'beautiful value' }
|
||||
let(:file) { fixture_file_upload('spec/fixtures/files/piece_justificative_0.pdf', 'application/pdf') }
|
||||
let(:now) { Time.zone.parse('01/01/2100') }
|
||||
|
@ -543,7 +543,7 @@ describe Users::DossiersController, type: :controller do
|
|||
id: dossier.id,
|
||||
dossier: {
|
||||
groupe_instructeur_id: dossier.groupe_instructeur_id,
|
||||
champs_attributes: [
|
||||
champs_public_attributes: [
|
||||
{
|
||||
id: first_champ.id,
|
||||
value: value
|
||||
|
@ -608,7 +608,7 @@ describe Users::DossiersController, type: :controller do
|
|||
{
|
||||
id: dossier.id,
|
||||
dossier: {
|
||||
champs_attributes: [
|
||||
champs_public_attributes: [
|
||||
{
|
||||
id: piece_justificative_champ.id,
|
||||
piece_justificative_file: file
|
||||
|
@ -703,14 +703,14 @@ describe Users::DossiersController, type: :controller do
|
|||
context 'when the champ is a phone number' do
|
||||
let(:procedure) { create(:procedure, :published, :with_phone) }
|
||||
let!(:dossier) { create(:dossier, :en_construction, user: user, procedure: procedure) }
|
||||
let(:first_champ) { dossier.champs.first }
|
||||
let(:first_champ) { dossier.champs_public.first }
|
||||
let(:now) { Time.zone.parse('01/01/2100') }
|
||||
|
||||
let(:submit_payload) do
|
||||
{
|
||||
id: dossier.id,
|
||||
dossier: {
|
||||
champs_attributes: [
|
||||
champs_public_attributes: [
|
||||
{
|
||||
id: first_champ.id,
|
||||
value: value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue