refactor(dossier_preloader): add load_one api
This commit is contained in:
parent
5920168077
commit
7e03f0c825
3 changed files with 6 additions and 2 deletions
|
@ -392,7 +392,7 @@ module Users
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossier_with_champs
|
def dossier_with_champs
|
||||||
DossierPreloader.new([dossier]).all.first
|
DossierPreloader.load_one(dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
def should_change_groupe_instructeur?
|
def should_change_groupe_instructeur?
|
||||||
|
|
|
@ -17,6 +17,10 @@ class DossierPreloader
|
||||||
dossiers
|
dossiers
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.load_one(dossier)
|
||||||
|
DossierPreloader.new([dossier]).all.first
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# returns: { revision_id : { type_de_champ_id : position } }
|
# returns: { revision_id : { type_de_champ_id : position } }
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe DossierPreloader do
|
||||||
let(:first_child) { subject.champs.second.champs.first }
|
let(:first_child) { subject.champs.second.champs.first }
|
||||||
|
|
||||||
describe 'all' do
|
describe 'all' do
|
||||||
subject { DossierPreloader.new([dossier]).all.first }
|
subject { DossierPreloader.load_one(dossier) }
|
||||||
|
|
||||||
before { subject }
|
before { subject }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue