graphql_controller_spec: populate all champs only when required
Creating a dossier with available champs populated is slow. We can create simpler dossiers in the default case, and only populate all champs when the example requires it. Speeds up this spec from 2mn 20s to 1m 55s.
This commit is contained in:
parent
bb1bc9140d
commit
e02251c0e5
1 changed files with 12 additions and 10 deletions
|
@ -2,16 +2,7 @@ describe API::V2::GraphqlController do
|
|||
let(:admin) { create(:administrateur) }
|
||||
let(:token) { admin.renew_api_token }
|
||||
let(:procedure) { create(:procedure, :published, :for_individual, :with_service, :with_all_champs, :with_all_annotations, administrateurs: [admin]) }
|
||||
let(:dossier) do
|
||||
dossier = create(:dossier,
|
||||
:en_construction,
|
||||
:with_populated_champs,
|
||||
:with_populated_annotations,
|
||||
:with_individual,
|
||||
procedure: procedure)
|
||||
create(:commentaire, :with_file, dossier: dossier, email: 'test@test.com')
|
||||
dossier
|
||||
end
|
||||
let(:dossier) { create(:dossier, :en_construction, :with_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, :archived, procedure: procedure, en_construction_at: 3.days.ago) }
|
||||
let(:dossiers) { [dossier2, dossier1, dossier] }
|
||||
|
@ -298,6 +289,17 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
|
||||
describe "dossier" do
|
||||
let(:dossier) do
|
||||
dossier = create(:dossier,
|
||||
:en_construction,
|
||||
:with_populated_champs,
|
||||
:with_populated_annotations,
|
||||
:with_individual,
|
||||
procedure: procedure)
|
||||
create(:commentaire, :with_file, dossier: dossier, email: 'test@test.com')
|
||||
dossier
|
||||
end
|
||||
|
||||
context "with individual" do
|
||||
let(:query) do
|
||||
"{
|
||||
|
|
Loading…
Add table
Reference in a new issue