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