factories: rename dossier for_individual to with_individual

This clarifies the distinction between

```
create :procedure, :for_individual
```

and

```
create :dossier, :with_individual
```
This commit is contained in:
Pierre de La Morinerie 2020-01-07 17:47:22 +01:00
parent 00e5b736fb
commit 724ff50363
9 changed files with 28 additions and 28 deletions

View file

@ -8,14 +8,14 @@ describe API::V2::GraphqlController do
dossier = create(:dossier,
:en_construction,
:with_all_champs,
:for_individual,
:with_individual,
procedure: procedure)
create(:commentaire, :with_file, dossier: dossier, email: 'test@test.com')
dossier
end
let(:dossier1) { create(:dossier, :en_construction, :for_individual, procedure: procedure, en_construction_at: 1.day.ago) }
let(:dossier2) { create(:dossier, :en_construction, :for_individual, procedure: procedure, en_construction_at: 3.days.ago) }
let(:dossier_brouillon) { create(:dossier, :for_individual, procedure: procedure) }
let(:dossier1) { create(:dossier, :en_construction, :with_individual, procedure: procedure, en_construction_at: 1.day.ago) }
let(:dossier2) { create(:dossier, :en_construction, :with_individual, procedure: procedure, en_construction_at: 3.days.ago) }
let(:dossier_brouillon) { create(:dossier, :with_individual, procedure: procedure) }
let(:dossiers) { [dossier2, dossier1, dossier] }
let(:instructeur) { create(:instructeur, followed_dossiers: dossiers) }
@ -416,7 +416,7 @@ describe API::V2::GraphqlController do
end
describe 'dossierPasserEnInstruction' do
let(:dossier) { create(:dossier, :en_construction, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :en_construction, :with_individual, procedure: procedure) }
let(:query) do
"mutation {
dossierPasserEnInstruction(input: {
@ -451,7 +451,7 @@ describe API::V2::GraphqlController do
end
context 'validation error' do
let(:dossier) { create(:dossier, :en_instruction, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
it "should fail" do
expect(gql_errors).to eq(nil)
@ -464,7 +464,7 @@ describe API::V2::GraphqlController do
end
describe 'dossierClasserSansSuite' do
let(:dossier) { create(:dossier, :en_instruction, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
let(:query) do
"mutation {
dossierClasserSansSuite(input: {
@ -501,7 +501,7 @@ describe API::V2::GraphqlController do
end
context 'validation error' do
let(:dossier) { create(:dossier, :accepte, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :accepte, :with_individual, procedure: procedure) }
it "should fail" do
expect(gql_errors).to eq(nil)
@ -514,7 +514,7 @@ describe API::V2::GraphqlController do
end
describe 'dossierRefuser' do
let(:dossier) { create(:dossier, :en_instruction, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
let(:query) do
"mutation {
dossierRefuser(input: {
@ -551,7 +551,7 @@ describe API::V2::GraphqlController do
end
context 'validation error' do
let(:dossier) { create(:dossier, :sans_suite, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :sans_suite, :with_individual, procedure: procedure) }
it "should fail" do
expect(gql_errors).to eq(nil)
@ -564,7 +564,7 @@ describe API::V2::GraphqlController do
end
describe 'dossierAccepter' do
let(:dossier) { create(:dossier, :en_instruction, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
let(:query) do
"mutation {
dossierAccepter(input: {
@ -634,7 +634,7 @@ describe API::V2::GraphqlController do
end
context 'validation error' do
let(:dossier) { create(:dossier, :refuse, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :refuse, :with_individual, procedure: procedure) }
it "should fail" do
expect(gql_errors).to eq(nil)

View file

@ -170,7 +170,7 @@ describe Users::DossiersController, type: :controller do
end
context 'when the identite cannot be updated by the user' do
let(:dossier) { create(:dossier, :for_individual, :en_instruction, user: user, procedure: procedure) }
let(:dossier) { create(:dossier, :with_individual, :en_instruction, user: user, procedure: procedure) }
let(:individual_params) { { gender: 'M', nom: 'Mouse', prenom: 'Mickey' } }
it 'redirects to the dossiers list' do

View file

@ -36,7 +36,7 @@ FactoryBot.define do
end
end
trait :for_individual do
trait :with_individual do
after(:build) do |dossier, evaluator|
# If the procedure was implicitely created by the factory,
# mark it automatically as for_individual.

View file

@ -3,7 +3,7 @@ require 'features/users/dossier_shared_examples.rb'
describe 'Dossier details:' do
let(:user) { create(:user) }
let(:procedure) { create(:simple_procedure) }
let(:dossier) { create(:dossier, :en_construction, :for_individual, :with_commentaires, user: user, procedure: procedure) }
let(:dossier) { create(:dossier, :en_construction, :with_individual, :with_commentaires, user: user, procedure: procedure) }
before do
visit_dossier dossier
@ -17,7 +17,7 @@ describe 'Dossier details:' do
end
describe "the user can see the mean time they are expected to wait" do
let(:other_dossier) { create(:dossier, :accepte, :for_individual, procedure: procedure, en_construction_at: 10.days.ago, en_instruction_at: 9.days.ago, processed_at: Time.zone.now) }
let(:other_dossier) { create(:dossier, :accepte, :with_individual, procedure: procedure, en_construction_at: 10.days.ago, en_instruction_at: 9.days.ago, processed_at: Time.zone.now) }
context "when the dossier is in construction" do
it "displays the estimated wait duration" do
@ -28,7 +28,7 @@ describe 'Dossier details:' do
end
context "when the dossier is in instruction" do
let(:dossier) { create(:dossier, :en_instruction, :for_individual, :with_commentaires, user: user, procedure: procedure) }
let(:dossier) { create(:dossier, :en_instruction, :with_individual, :with_commentaires, user: user, procedure: procedure) }
it "displays the estimated wait duration" do
other_dossier

View file

@ -8,7 +8,7 @@ feature 'Invitations' do
let(:invite) { create(:invite, user: invited_user, dossier: dossier) }
context 'when the dossier is a brouillon' do
let!(:dossier) { create(:dossier, :for_individual, state: Dossier.states.fetch(:brouillon), user: owner, procedure: procedure) }
let!(:dossier) { create(:dossier, :with_individual, state: Dossier.states.fetch(:brouillon), user: owner, procedure: procedure) }
scenario 'on the form, the owner of a dossier can invite another user to collaborate on the dossier', js: true do
log_in(owner)
@ -69,7 +69,7 @@ feature 'Invitations' do
end
context 'when the dossier is en_construction' do
let!(:dossier) { create(:dossier, :for_individual, :en_construction, user: owner, procedure: procedure) }
let!(:dossier) { create(:dossier, :with_individual, :en_construction, user: owner, procedure: procedure) }
scenario 'on dossier details, the owner of a dossier can invite another user to collaborate on the dossier', js: true do
log_in(owner)

View file

@ -3,7 +3,7 @@ require "spec_helper"
RSpec.describe NotificationMailer, type: :mailer do
let(:user) { create(:user) }
let(:procedure) { create(:simple_procedure) }
let(:dossier) { create(:dossier, :en_construction, :for_individual, :with_service, user: user, procedure: procedure) }
let(:dossier) { create(:dossier, :en_construction, :with_individual, :with_service, user: user, procedure: procedure) }
describe '.send_dossier_received' do
let(:email_template) { create(:received_mail, subject: 'Email subject', body: 'Your dossier was processed. Thanks.') }

View file

@ -589,7 +589,7 @@ describe Dossier do
end
context 'when there is an individual' do
let(:dossier) { create(:dossier, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :with_individual, procedure: procedure) }
it { is_expected.to eq("#{dossier.individual.nom} #{dossier.individual.prenom}") }
end

View file

@ -33,7 +33,7 @@ describe ProcedureExportService do
end
context 'with dossier' do
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :for_individual, procedure: procedure) }
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) }
let(:nominal_headers) do
[
@ -286,7 +286,7 @@ describe ProcedureExportService do
end
context 'with avis' do
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :for_individual, procedure: procedure) }
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) }
let!(:avis) { create(:avis, :with_answer, dossier: dossier) }
it 'should have headers' do
@ -307,8 +307,8 @@ describe ProcedureExportService do
context 'with repetitions' do
let!(:dossiers) do
[
create(:dossier, :en_instruction, :with_all_champs, :for_individual, procedure: procedure),
create(:dossier, :en_instruction, :with_all_champs, :for_individual, procedure: procedure)
create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure),
create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure)
]
end
let(:champ_repetition) { dossiers.first.champs.find { |champ| champ.type_champ == 'repetition' } }
@ -341,7 +341,7 @@ describe ProcedureExportService do
end
context 'with non unique labels' do
let(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :for_individual, procedure: procedure) }
let(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) }
let(:champ_repetition) { dossier.champs.find { |champ| champ.type_champ == 'repetition' } }
let(:type_de_champ_repetition) { create(:type_de_champ_repetition, procedure: procedure, libelle: champ_repetition.libelle) }
let!(:another_champ_repetition) { create(:champ_repetition, type_de_champ: type_de_champ_repetition, dossier: dossier) }

View file

@ -53,7 +53,7 @@ RSpec.describe 'commencer/show.html.haml', type: :view do
context 'and they have a submitted dossier' do
let!(:brouillon) { create(:dossier, user: user, procedure: procedure) }
let!(:dossier) { create(:dossier, :en_construction, :for_individual, user: user, procedure: procedure) }
let!(:dossier) { create(:dossier, :en_construction, :with_individual, user: user, procedure: procedure) }
it_behaves_like 'it renders a link to create a new dossier', 'Commencer un nouveau dossier'
@ -66,7 +66,7 @@ RSpec.describe 'commencer/show.html.haml', type: :view do
context 'and they have several submitted dossiers' do
let!(:brouillon) { create(:dossier, user: user, procedure: procedure) }
let!(:dossiers) { create_list(:dossier, 2, :en_construction, :for_individual, user: user, procedure: procedure) }
let!(:dossiers) { create_list(:dossier, 2, :en_construction, :with_individual, user: user, procedure: procedure) }
it_behaves_like 'it renders a link to create a new dossier', 'Commencer un nouveau dossier'