commit
af0640d37e
43 changed files with 87 additions and 87 deletions
2
Gemfile
2
Gemfile
|
@ -120,7 +120,7 @@ gem 'rack-mini-profiler'
|
|||
group :test do
|
||||
gem 'capybara'
|
||||
gem 'launchy'
|
||||
gem 'factory_girl'
|
||||
gem 'factory_bot'
|
||||
gem 'database_cleaner'
|
||||
gem 'webmock'
|
||||
gem 'shoulda-matchers', require: false
|
||||
|
|
|
@ -191,7 +191,7 @@ GEM
|
|||
eventmachine (1.2.1)
|
||||
excon (0.60.0)
|
||||
execjs (2.7.0)
|
||||
factory_girl (4.9.0)
|
||||
factory_bot (4.8.2)
|
||||
activesupport (>= 3.0.0)
|
||||
faraday (0.12.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
|
@ -780,7 +780,7 @@ DEPENDENCIES
|
|||
devise
|
||||
dotenv-rails
|
||||
draper
|
||||
factory_girl
|
||||
factory_bot
|
||||
fog
|
||||
fog-openstack
|
||||
font-awesome-rails
|
||||
|
|
|
@ -4,11 +4,11 @@ describe StatsController, type: :controller do
|
|||
describe "#last_four_months_hash" do
|
||||
context "while a regular user is logged in" do
|
||||
before do
|
||||
FactoryGirl.create(:procedure, :created_at => 6.months.ago, :updated_at => 6.months.ago)
|
||||
FactoryGirl.create(:procedure, :created_at => 2.months.ago, :updated_at => 62.days.ago)
|
||||
FactoryGirl.create(:procedure, :created_at => 2.months.ago, :updated_at => 62.days.ago)
|
||||
FactoryGirl.create(:procedure, :created_at => 2.months.ago, :updated_at => 31.days.ago)
|
||||
FactoryGirl.create(:procedure, :created_at => 2.months.ago, :updated_at => Time.now)
|
||||
FactoryBot.create(:procedure, :created_at => 6.months.ago, :updated_at => 6.months.ago)
|
||||
FactoryBot.create(:procedure, :created_at => 2.months.ago, :updated_at => 62.days.ago)
|
||||
FactoryBot.create(:procedure, :created_at => 2.months.ago, :updated_at => 62.days.ago)
|
||||
FactoryBot.create(:procedure, :created_at => 2.months.ago, :updated_at => 31.days.ago)
|
||||
FactoryBot.create(:procedure, :created_at => 2.months.ago, :updated_at => Time.now)
|
||||
@controller = StatsController.new
|
||||
|
||||
allow(@controller).to receive(:administration_signed_in?).and_return(false)
|
||||
|
@ -28,10 +28,10 @@ describe StatsController, type: :controller do
|
|||
|
||||
context "while a super admin is logged in" do
|
||||
before do
|
||||
FactoryGirl.create(:procedure, :updated_at => 6.months.ago)
|
||||
FactoryGirl.create(:procedure, :updated_at => 45.days.ago)
|
||||
FactoryGirl.create(:procedure, :updated_at => 1.day.ago)
|
||||
FactoryGirl.create(:procedure, :updated_at => 1.day.ago)
|
||||
FactoryBot.create(:procedure, :updated_at => 6.months.ago)
|
||||
FactoryBot.create(:procedure, :updated_at => 45.days.ago)
|
||||
FactoryBot.create(:procedure, :updated_at => 1.day.ago)
|
||||
FactoryBot.create(:procedure, :updated_at => 1.day.ago)
|
||||
|
||||
@controller = StatsController.new
|
||||
|
||||
|
@ -54,11 +54,11 @@ describe StatsController, type: :controller do
|
|||
describe '#cumulative_hash' do
|
||||
before do
|
||||
Timecop.freeze(Time.new(2016, 10, 2))
|
||||
FactoryGirl.create(:procedure, :created_at => 55.days.ago, :updated_at => 43.days.ago)
|
||||
FactoryGirl.create(:procedure, :created_at => 45.days.ago, :updated_at => 40.days.ago)
|
||||
FactoryGirl.create(:procedure, :created_at => 45.days.ago, :updated_at => 20.days.ago)
|
||||
FactoryGirl.create(:procedure, :created_at => 15.days.ago, :updated_at => 20.days.ago)
|
||||
FactoryGirl.create(:procedure, :created_at => 15.days.ago, :updated_at => 1.hour.ago)
|
||||
FactoryBot.create(:procedure, :created_at => 55.days.ago, :updated_at => 43.days.ago)
|
||||
FactoryBot.create(:procedure, :created_at => 45.days.ago, :updated_at => 40.days.ago)
|
||||
FactoryBot.create(:procedure, :created_at => 45.days.ago, :updated_at => 20.days.ago)
|
||||
FactoryBot.create(:procedure, :created_at => 15.days.ago, :updated_at => 20.days.ago)
|
||||
FactoryBot.create(:procedure, :created_at => 15.days.ago, :updated_at => 1.hour.ago)
|
||||
end
|
||||
|
||||
after { Timecop.return }
|
||||
|
@ -142,21 +142,21 @@ describe StatsController, type: :controller do
|
|||
# dossier_p1_c: 5 days
|
||||
|
||||
before do
|
||||
procedure_1 = FactoryGirl.create(:procedure)
|
||||
procedure_2 = FactoryGirl.create(:procedure)
|
||||
dossier_p1_a = FactoryGirl.create(:dossier,
|
||||
procedure_1 = FactoryBot.create(:procedure)
|
||||
procedure_2 = FactoryBot.create(:procedure)
|
||||
dossier_p1_a = FactoryBot.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:en_construction_at => 2.months.ago.beginning_of_month,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 3.days)
|
||||
dossier_p1_b = FactoryGirl.create(:dossier,
|
||||
dossier_p1_b = FactoryBot.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:en_construction_at => 2.months.ago.beginning_of_month,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 1.days)
|
||||
dossier_p1_c = FactoryGirl.create(:dossier,
|
||||
dossier_p1_c = FactoryBot.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:en_construction_at => 1.months.ago.beginning_of_month,
|
||||
:processed_at => 1.months.ago.beginning_of_month + 5.days)
|
||||
dossier_p2_a = FactoryGirl.create(:dossier,
|
||||
dossier_p2_a = FactoryBot.create(:dossier,
|
||||
:procedure => procedure_2,
|
||||
:en_construction_at => 2.month.ago.beginning_of_month,
|
||||
:processed_at => 2.month.ago.beginning_of_month + 4.days)
|
||||
|
@ -190,24 +190,24 @@ describe StatsController, type: :controller do
|
|||
# dossier_p1_c: 50 minutes
|
||||
|
||||
before do
|
||||
procedure_1 = FactoryGirl.create(:procedure, :with_type_de_champ, :types_de_champ_count => 24)
|
||||
procedure_2 = FactoryGirl.create(:procedure, :with_type_de_champ, :types_de_champ_count => 48)
|
||||
dossier_p1_a = FactoryGirl.create(:dossier,
|
||||
procedure_1 = FactoryBot.create(:procedure, :with_type_de_champ, :types_de_champ_count => 24)
|
||||
procedure_2 = FactoryBot.create(:procedure, :with_type_de_champ, :types_de_champ_count => 48)
|
||||
dossier_p1_a = FactoryBot.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:created_at => 2.months.ago.beginning_of_month,
|
||||
:en_construction_at => 2.months.ago.beginning_of_month + 30.minutes,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
||||
dossier_p1_b = FactoryGirl.create(:dossier,
|
||||
dossier_p1_b = FactoryBot.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:created_at => 2.months.ago.beginning_of_month,
|
||||
:en_construction_at => 2.months.ago.beginning_of_month + 10.minutes,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
||||
dossier_p1_c = FactoryGirl.create(:dossier,
|
||||
dossier_p1_c = FactoryBot.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:created_at => 1.months.ago.beginning_of_month,
|
||||
:en_construction_at => 1.months.ago.beginning_of_month + 50.minutes,
|
||||
:processed_at => 1.months.ago.beginning_of_month + 1.day)
|
||||
dossier_p2_a = FactoryGirl.create(:dossier,
|
||||
dossier_p2_a = FactoryBot.create(:dossier,
|
||||
:procedure => procedure_2,
|
||||
:created_at => 2.month.ago.beginning_of_month,
|
||||
:en_construction_at => 2.month.ago.beginning_of_month + 80.minutes,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
sequence(:administrateur_email) { |n| "admin#{n}@admin.com" }
|
||||
factory :administrateur do
|
||||
email { generate(:administrateur_email) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
sequence(:administration_email) { |n| "plop#{n}@plop.com" }
|
||||
factory :administration do
|
||||
email { generate(:administration_email) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :assign_to do
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :attestation_template do
|
||||
title 'title'
|
||||
body 'body'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :avis do
|
||||
introduction 'Bonjour, merci de me donner votre avis sur ce dossier'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :cadastre do
|
||||
numero '001'
|
||||
feuille 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :cerfa do
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :champ do
|
||||
type_de_champ { FactoryGirl.create(:type_de_champ_public) }
|
||||
type_de_champ { FactoryBot.create(:type_de_champ_public) }
|
||||
|
||||
trait :checkbox do
|
||||
type_de_champ { FactoryGirl.create(:type_de_champ_public, :checkbox) }
|
||||
type_de_champ { FactoryBot.create(:type_de_champ_public, :checkbox) }
|
||||
end
|
||||
|
||||
trait :header_section do
|
||||
type_de_champ { FactoryGirl.create(:type_de_champ_public, :header_section) }
|
||||
type_de_champ { FactoryBot.create(:type_de_champ_public, :header_section) }
|
||||
end
|
||||
|
||||
trait :explication do
|
||||
type_de_champ { FactoryGirl.create(:type_de_champ_public, :explication) }
|
||||
type_de_champ { FactoryBot.create(:type_de_champ_public, :explication) }
|
||||
end
|
||||
|
||||
trait :dossier_link do
|
||||
type_de_champ { FactoryGirl.create(:type_de_champ_public, :type_dossier_link) }
|
||||
type_de_champ { FactoryBot.create(:type_de_champ_public, :type_dossier_link) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :commentaire do
|
||||
body 'plop'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :dossier do
|
||||
state 'brouillon'
|
||||
association :user, factory: [:user]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :drop_down_list do
|
||||
value "val1\r\nval2\r\n--separateur--\r\nval3"
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :entreprise do
|
||||
siren '440117620'
|
||||
capital_social 537_100_000
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :etablissement do
|
||||
siret '44011762001530'
|
||||
siege_social true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :exercice do
|
||||
ca '12345678'
|
||||
dateFinExercice "2014-12-30 23:00:00"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :follow do
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :france_connect_information do
|
||||
given_name 'plop'
|
||||
family_name 'plip'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
sequence(:gestionnaire_email) { |n| "gest#{n}@gest.com" }
|
||||
factory :gestionnaire do
|
||||
email { generate(:gestionnaire_email) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :individual do
|
||||
gender 'M.'
|
||||
nom 'Julien'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :invite do
|
||||
email 'plop@octo.com'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :invite_user do
|
||||
email 'plop@octo.com'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :closed_mail, class: Mails::ClosedMail do
|
||||
subject "Subject, voila voila"
|
||||
body "Blabla ceci est mon body"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :module_api_carto do
|
||||
use_api_carto false
|
||||
quartiers_prioritaires false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :notification do
|
||||
type_notif 'commentaire'
|
||||
liste []
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :piece_justificative do
|
||||
trait :rib do
|
||||
content Rack::Test::UploadedFile.new("./spec/support/files/RIB.pdf", 'application/pdf')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
sequence(:published_path) { |n| "fake_path#{n}" }
|
||||
factory :procedure do
|
||||
lien_demarche 'http://localhost'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :procedure_path do
|
||||
path 'fake_path'
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :quartier_prioritaire do
|
||||
code 'QPcode'
|
||||
commune 'Paris'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :rna_information do
|
||||
association_id "W072000535"
|
||||
titre "ASSOCIATION POUR LA PROMOTION DE SPECTACLES AU CHATEAU DE ROCHEMAURE"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :type_de_champ_private do
|
||||
sequence(:libelle) { |n| "Libelle champ privé #{n}" }
|
||||
sequence(:description) { |n| "description du champ privé #{n}" }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :type_de_champ_public do
|
||||
sequence(:libelle) { |n| "Libelle du champ #{n}" }
|
||||
sequence(:description) { |n| "description du champ #{n}" }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :type_de_piece_justificative do
|
||||
libelle 'RIB'
|
||||
description 'Releve identité bancaire'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
sequence(:user_email) { |n| "user#{n}@user.com" }
|
||||
factory :user do
|
||||
email { generate(:user_email) }
|
||||
|
|
|
@ -11,24 +11,24 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
context 'Right after sign_in I shall see all procedure states links' do
|
||||
scenario 'Finding draft procedures' do
|
||||
page.find_by_id('draft-procedures').click
|
||||
expect(page).to have_current_path(admin_procedures_draft_path, only_path: true)
|
||||
expect(page).to have_current_path(admin_procedures_draft_path)
|
||||
end
|
||||
|
||||
scenario 'Finding active procedures' do
|
||||
page.find_by_id('active-procedures').click
|
||||
expect(page).to have_current_path(admin_procedures_path, only_path: true)
|
||||
expect(page).to have_current_path(admin_procedures_path)
|
||||
end
|
||||
|
||||
scenario 'Finding archived procedures' do
|
||||
page.find_by_id('archived-procedures').click
|
||||
expect(page).to have_current_path(admin_procedures_archived_path, only_path: true)
|
||||
expect(page).to have_current_path(admin_procedures_archived_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'Creating a new procedure' do
|
||||
scenario 'Finding new procedure link' do
|
||||
page.find_by_id('new-procedure').click
|
||||
expect(page).to have_current_path(new_admin_procedure_path, only_path: true)
|
||||
expect(page).to have_current_path(new_admin_procedure_path)
|
||||
end
|
||||
|
||||
scenario 'Finding save button for new procedure, libelle and description required' do
|
||||
|
|
|
@ -107,7 +107,7 @@ feature 'The gestionnaire part' do
|
|||
end
|
||||
|
||||
scenario 'A gestionnaire can see the personnes impliquées' do
|
||||
gestionnaire2 = FactoryGirl.create(:gestionnaire, password: password)
|
||||
gestionnaire2 = FactoryBot.create(:gestionnaire, password: password)
|
||||
|
||||
log_in(gestionnaire.email, password)
|
||||
|
||||
|
|
|
@ -21,30 +21,30 @@ feature 'As a User I wanna create a dossier' do
|
|||
scenario "with a proper date input field for birthdate (type='date' supported)" do
|
||||
fill_in 'dossier_individual_attributes_birthdate', with: '1987-10-14'
|
||||
page.find_by_id('etape_suivante').click
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
page.find_by_id('etape_suivante').click
|
||||
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||
page.find_by_id('suivant').click
|
||||
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
end
|
||||
|
||||
scenario "with a basic text input field for birthdate (type='date' unsupported)" do
|
||||
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
|
||||
page.find_by_id('etape_suivante').click
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
page.find_by_id('etape_suivante').click
|
||||
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||
page.find_by_id('suivant').click
|
||||
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Identification through siret', vcr: { cassette_name: 'search_ban_paris' }, js: true do
|
||||
login_as user, scope: :user
|
||||
visit commencer_path(procedure_path: procedure_with_siret.path)
|
||||
expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s))
|
||||
fill_in 'dossier-siret', with: siret
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
|
||||
|
@ -59,11 +59,11 @@ feature 'As a User I wanna create a dossier' do
|
|||
expect(page).to have_css('#recap-info-entreprise')
|
||||
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
||||
page.find_by_id('etape_suivante').click
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s))
|
||||
page.find_by_id('etape_suivante').click
|
||||
fill_in "champs_#{procedure_with_siret.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||
page.find_by_id('suivant').click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_with_siret.dossiers.last.id.to_s))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ feature 'As a User I want to edit a dossier I own' do
|
|||
|
||||
scenario 'Getting a dossier, I want to create a new message on', js: true do
|
||||
page.find_by_id('tr_dossier_' + dossier.id.to_s).click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s))
|
||||
page.find_by_id('open-message').click
|
||||
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
|
||||
page.find_by_id('save-message').click
|
||||
|
@ -31,18 +31,18 @@ feature 'As a User I want to edit a dossier I own' do
|
|||
|
||||
scenario 'On the same dossier, I want to edit informations', js: true do
|
||||
page.find_by_id('tr_dossier_' + dossier.id.to_s).click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s))
|
||||
|
||||
# Linked Dossier
|
||||
linked_dossier_id = dossier.champs.find { |c| c.type_de_champ.type_champ == 'dossier_link' }.value
|
||||
expect(page).to have_link("Dossier #{linked_dossier_id}")
|
||||
|
||||
page.find_by_id('edit-dossier').click
|
||||
expect(page).to have_current_path(users_dossier_description_path(dossier.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_description_path(dossier.id.to_s))
|
||||
champ_id = dossier.champs.find { |t| t.type_champ == "text" }.id
|
||||
fill_in "champs_#{champ_id.to_s}", with: 'Contenu du champ 1'
|
||||
page.find_by_id('modification_terminee').click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s), only_path: true)
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s))
|
||||
expect(page.find("#champ-#{champ_id}-value").text).to eq('Contenu du champ 1')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ describe Commentaire do
|
|||
let(:user_invite) { create(:user) }
|
||||
|
||||
before do
|
||||
FactoryGirl.create(:invite_user, email: "invite@tps.apientreprise.fr", dossier: dossier, user: user_invite)
|
||||
FactoryBot.create(:invite_user, email: "invite@tps.apientreprise.fr", dossier: dossier, user: user_invite)
|
||||
end
|
||||
|
||||
it "calls notify_gestionnaires" do
|
||||
|
|
|
@ -26,7 +26,7 @@ require 'database_cleaner'
|
|||
require 'webmock/rspec'
|
||||
require 'shoulda-matchers'
|
||||
require 'devise'
|
||||
require 'factory_girl'
|
||||
require 'factory_bot'
|
||||
|
||||
require 'selenium/webdriver'
|
||||
Capybara.javascript_driver = :headless_chrome
|
||||
|
@ -109,7 +109,7 @@ RSpec.configure do |config|
|
|||
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||
config.include Devise::Test::ControllerHelpers, type: :view
|
||||
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
|
||||
config.before(:each) do
|
||||
allow_any_instance_of(PieceJustificativeUploader).to receive(:generate_secure_token).and_return("3dbb3535-5388-4a37-bc2d-778327b9f997")
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
RSpec.configure do |config|
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ module FeatureHelpers
|
|||
end
|
||||
|
||||
def create_dossier
|
||||
dossier = FactoryGirl.create(:dossier)
|
||||
dossier = FactoryBot.create(:dossier)
|
||||
dossier
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue