update features specs to use revisions

This commit is contained in:
Paul Chavard 2020-08-27 19:56:34 +02:00
parent 1488e0964b
commit dee12a2b0b
5 changed files with 18 additions and 22 deletions

View file

@ -6,11 +6,11 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
let(:administrateur) { create(:administrateur) }
before do
create :procedure, :with_service, :with_instructeur,
aasm_state: :publiee, published_at: Time.zone.now,
create(:procedure, :with_service, :with_instructeur,
aasm_state: :publiee,
administrateurs: [administrateur],
libelle: 'libellé de la procédure',
path: 'libelle-de-la-procedure'
path: 'libelle-de-la-procedure')
login_as administrateur.user, scope: :user
end

View file

@ -91,7 +91,7 @@ feature 'Instructing a dossier:' do
end
scenario 'A instructeur can see the personnes impliquées' do
instructeur2 = FactoryBot.create(:instructeur, password: password)
instructeur2 = create(:instructeur, password: password)
log_in(instructeur.email, password)
@ -113,8 +113,8 @@ feature 'Instructing a dossier:' do
end
scenario 'A instructeur can send a dossier to several instructeurs', js: true do
instructeur_2 = FactoryBot.create(:instructeur)
instructeur_3 = FactoryBot.create(:instructeur)
instructeur_2 = create(:instructeur)
instructeur_3 = create(:instructeur)
procedure.defaut_groupe_instructeur.instructeurs << [instructeur_2, instructeur_3]
send_dossier = double()

View file

@ -122,7 +122,7 @@ feature 'As an administrateur I can edit types de champ', js: true do
fill_in 'champ-0-libelle', with: 'Libellé de champ carte', fill_options: { clear: :backspace }
check 'Cadastres'
wait_until { procedure.types_de_champ.first.cadastres == true }
wait_until { procedure.draft_types_de_champ.first.cadastres == true }
expect(page).to have_content('Formulaire enregistré')
preview_window = window_opened_by { click_on 'Prévisualiser le formulaire' }
@ -139,7 +139,7 @@ feature 'As an administrateur I can edit types de champ', js: true do
fill_in 'champ-0-libelle', with: 'Libellé de champ menu déroulant', fill_options: { clear: :backspace }
fill_in 'champ-0-drop_down_list_value', with: 'Un menu', fill_options: { clear: :backspace }
wait_until { procedure.types_de_champ.first.drop_down_list_options == ['', 'Un menu'] }
wait_until { procedure.draft_types_de_champ.first.drop_down_list_options == ['', 'Un menu'] }
expect(page).to have_content('Formulaire enregistré')
page.refresh

View file

@ -97,9 +97,7 @@ feature 'The user' do
end
let(:procedure_with_repetition) do
tdc = create(:type_de_champ_repetition, libelle: 'repetition')
tdc.types_de_champ << create(:type_de_champ_text, libelle: 'text')
create(:procedure, :published, :for_individual, types_de_champ: [tdc])
create(:procedure, :published, :for_individual, :with_repetition)
end
scenario 'fill a dossier with repetition', js: true do
@ -107,13 +105,13 @@ feature 'The user' do
fill_individual
fill_in('text', with: 'super texte')
expect(page).to have_field('text', with: 'super texte')
fill_in('sub type de champ', with: 'super texte')
expect(page).to have_field('sub type de champ', with: 'super texte')
click_on 'Ajouter un élément pour'
within '.row-1' do
fill_in('text', with: 'un autre texte')
fill_in('sub type de champ', with: 'un autre texte')
end
expect(page).to have_content('Supprimer', count: 2)
@ -132,7 +130,7 @@ feature 'The user' do
end
let(:simple_procedure) do
tdcs = [create(:type_de_champ, mandatory: true, libelle: 'texte obligatoire')]
tdcs = [build(:type_de_champ, mandatory: true, libelle: 'texte obligatoire')]
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
end
@ -161,14 +159,14 @@ feature 'The user' do
end
let(:procedure_with_pj) do
tdcs = [create(:type_de_champ_piece_justificative, mandatory: true, libelle: 'Pièce justificative')]
tdcs = [build(:type_de_champ_piece_justificative, mandatory: true, libelle: 'Pièce justificative')]
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
end
let(:procedure_with_pjs) do
tdcs = [
create(:type_de_champ_piece_justificative, mandatory: true, libelle: 'Pièce justificative 1', order_place: 1),
create(:type_de_champ_piece_justificative, mandatory: true, libelle: 'Pièce justificative 2', order_place: 2)
build(:type_de_champ_piece_justificative, mandatory: true, libelle: 'Pièce justificative 1', position: 1),
build(:type_de_champ_piece_justificative, mandatory: true, libelle: 'Pièce justificative 2', position: 2)
]
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
end

View file

@ -13,12 +13,10 @@ feature 'linked dropdown lists' do
Secondary 2.3
END_OF_LIST
end
let(:type_de_champ) { create(:type_de_champ_linked_drop_down_list, libelle: 'linked dropdown', drop_down_list_value: list_items) }
let(:type_de_champ) { build(:type_de_champ_linked_drop_down_list, libelle: 'linked dropdown', drop_down_list_value: list_items) }
let!(:procedure) do
p = create(:procedure, :published, :for_individual)
p.types_de_champ << type_de_champ
p
create(:procedure, :published, :for_individual, types_de_champ: [type_de_champ])
end
let(:user_dossier) { user.dossiers.first }