diff --git a/Gemfile b/Gemfile
index 4e03bcce1..456da8de1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -99,6 +99,8 @@ gem 'sanitize-url'
gem 'flipflop'
+gem 'aasm'
+
# Cron jobs
gem 'delayed_job_active_record'
gem "daemons"
diff --git a/Gemfile.lock b/Gemfile.lock
index f8460ab99..532fc7acb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -29,6 +29,8 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
+ aasm (4.12.3)
+ concurrent-ruby (~> 1.0)
actioncable (5.2.0)
actionpack (= 5.2.0)
nio4r (~> 2.0)
@@ -779,6 +781,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ aasm
active_model_serializers
administrate
apipie-rails
diff --git a/README.md b/README.md
index 77e1fbc6d..22282b41a 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
## Context
-demarches-simplifiees.fr est un site web conçue afin de répondre au besoin urgent de l'État d'appliquer la directive sur le 100 % dématérialisation pour les procédures administratives.
+demarches-simplifiees.fr est un site web conçu afin de répondre au besoin urgent de l'État d'appliquer la directive sur le 100 % dématérialisation pour les procédures administratives.
## Dépendances
diff --git a/app/assets/images/mailer/gestionnaire_mailer/logo.png b/app/assets/images/mailer/gestionnaire_mailer/logo.png
old mode 100755
new mode 100644
index 1b1255204..34a48e8bc
Binary files a/app/assets/images/mailer/gestionnaire_mailer/logo.png and b/app/assets/images/mailer/gestionnaire_mailer/logo.png differ
diff --git a/app/assets/javascripts/mailjet.js b/app/assets/javascripts/mailjet.js
new file mode 100644
index 000000000..42ba7b513
--- /dev/null
+++ b/app/assets/javascripts/mailjet.js
@@ -0,0 +1,132 @@
+if (typeof wScriptAlreadyLoaded === "undefined") {
+ var wScriptAlreadyLoaded = true;
+
+ // Array of popin translations
+ var i8nMessages = [];
+ i8nMessages['en_US'] = [];
+ i8nMessages['fr_FR'] = [];
+ i8nMessages['de_DE'] = [];
+ i8nMessages['es_ES'] = [];
+ i8nMessages['en_US']['iframe-error'] = 'Your browser does not support the IFrame element';
+ i8nMessages['en_US']['close-popin'] = 'Close';
+ i8nMessages['fr_FR']['iframe-error'] = 'Votre navigateur ne supporte pas l\'élément iframe';
+ i8nMessages['fr_FR']['close-popin'] = 'Fermer';
+ i8nMessages['de_DE']['iframe-error'] = 'Ihr navigator verträgt kein Element iframe';
+ i8nMessages['de_DE']['close-popin'] = 'Schließen';
+ i8nMessages['es_ES']['iframe-error'] = 'Su navegante no soporta el elemento iframe';
+ i8nMessages['es_ES']['close-popin'] = 'Cerrarse';
+
+ window.onload = function() {
+ // Display popin when click event occure on widget button
+ Array.prototype.forEach.call(document.getElementsByClassName("mj-w-btn"), function(btnNode) {
+ btnNode.style.cursor = "pointer";
+ btnNode.addEventListener("click", function(event) {
+ mjOpenPopin(event, this);
+ });
+ });
+
+ mjOpenPopin = function(event, element) {
+ event.preventDefault();
+ //event.stopPropagation();
+
+ //var token = str.substring(btnNode.id.lastIndexOf("-") + 1, btnNode.id.length - btnNode.id.lastIndexOf("-"));
+ var token = element.getAttribute("data-token");
+
+ //Register parameters
+ var widgetPopinData = document.querySelector(".mj-w-data[data-token='" + token + "']");
+ if (widgetPopinData) {
+ var apiKey = widgetPopinData.getAttribute("data-apikey");
+ var wId = widgetPopinData.getAttribute("data-w-id");
+ var locale = widgetPopinData.getAttribute("data-lang");
+ var base = widgetPopinData.getAttribute("data-base");
+ var width = widgetPopinData.getAttribute("data-width");
+ var height = widgetPopinData.getAttribute("data-height");
+ var statics = widgetPopinData.getAttribute("data-statics");
+
+ // Call to Mailjet CSS file
+ var cssFile = document.createElement("link");
+ cssFile.setAttribute("rel", "stylesheet");
+ cssFile.setAttribute("type", "text/css");
+ if (statics) {
+ base += "/" + statics;
+ }
+ cssFile.setAttribute("href", base + "/css/w-popin-less.css");
+ document.getElementsByTagName("head")[0].appendChild(cssFile);
+
+ var htmlCode = "
" +
+ "
" +
+ "
" +
+ "
" +
+ "
" +
+ "
" +
+ "
";
+
+ widgetPopinData.innerHTML = htmlCode;
+
+ document.getElementById("mj-w-iframe").onload = function() {
+
+ document.getElementById("mj-w-iframe").style.height= height + "px";
+ document.getElementById('mj-w-close-img').style.display = "block";
+ document.getElementById("mj-w-loader").style.display = "none";
+ document.getElementById("mj-w-popin-block").style.border = "none";
+ if (window.matchMedia("(max-width: 767px)").matches) {
+ document.getElementById("mj-w-iframe").style.width = '100%';
+ document.getElementById("mj-w-popin-block").style.height = 'auto';
+ document.getElementById("mj-w-popin-block").style.width = '90%';
+ }
+ };
+
+ var closeImgNode = document.getElementById("mj-w-close-img");
+ closeImgNode.addEventListener("click", function(event) {
+ closePopin();
+ event.preventDefault();
+ });
+
+ document.addEventListener("keydown", escapeEvent);
+ document.getElementById("mj-w-iframe").onclick=function(event){
+ event.stopPropagation();
+ };
+ //document.addEventListener("click");
+
+ document.getElementById("mj-w-overlay").style.display = "block";
+ document.getElementById("mj-w-overlay").addEventListener("click", function(event){
+ closePopin();
+ event.preventDefault();
+ });
+ }
+ }
+
+ // Escape event : close popin
+ function escapeEvent(e) {
+ if (e.keyCode == 27) { // Escape key
+ closePopin();
+ }
+ }
+
+ // Close popin (remove popin HTML code)
+ function closePopin() {
+ var rootContainer = document.getElementById("mj-w-overlay");
+ if(rootContainer) {
+ rootContainer.parentNode.removeChild(rootContainer);
+ }
+ document.removeEventListener("keypress", escapeEvent);
+ }
+
+ window.onresize = function(event) {
+ if (window.matchMedia("(max-width: 767px)").matches) {
+ var popin = document.getElementById("mj-w-popin-block");
+ var iframe = document.getElementById("mj-w-iframe");
+ if (popin) {
+ popin.style.height = 'auto';
+ popin.style.width = '90%';
+ }
+ if (iframe) {
+ iframe.style.width = '100%';
+ }
+ }
+ }
+
+ };
+}
diff --git a/app/models/procedure.rb b/app/models/procedure.rb
index b9ee0dfa4..218081808 100644
--- a/app/models/procedure.rb
+++ b/app/models/procedure.rb
@@ -63,7 +63,7 @@ class Procedure < ApplicationRecord
def hide!
now = DateTime.now
- self.update(hidden_at: now)
+ self.update(hidden_at: now, aasm_state: :hidden)
self.dossiers.update_all(hidden_at: now)
end
@@ -153,7 +153,8 @@ class Procedure < ApplicationRecord
end
def publish!(path)
- self.update!({ published_at: Time.now, archived_at: nil })
+ now = Time.now
+ self.update!({ test_started_at: now, published_at: now, archived_at: nil, aasm_state: :publiee })
ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur)
end
@@ -162,7 +163,7 @@ class Procedure < ApplicationRecord
end
def archive
- self.update!(archived_at: Time.now)
+ self.update!(archived_at: Time.now, aasm_state: :archivee)
end
def archivee?
diff --git a/app/views/admin/procedures/index.html.haml b/app/views/admin/procedures/index.html.haml
index 89ed60b86..540c498fc 100644
--- a/app/views/admin/procedures/index.html.haml
+++ b/app/views/admin/procedures/index.html.haml
@@ -6,7 +6,7 @@
.carret-right
.carret-down
Procédures
- %a{ href: '/admin/procedures/new' }
+ %a{ href: new_from_existing_admin_procedures_path }
#new-procedure.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
Nouvelle
diff --git a/app/views/admin/procedures/new.html.haml b/app/views/admin/procedures/new.html.haml
index 98c92f966..1b203b146 100644
--- a/app/views/admin/procedures/new.html.haml
+++ b/app/views/admin/procedures/new.html.haml
@@ -1,7 +1,3 @@
-.row.white-back
- %a{ href: new_from_existing_admin_procedures_path, class: 'btn-sm btn-primary' }
- Créer une nouvelle procédure à partir d'une procédure existante
-
.row.white-back
%h2
= t('dynamics.admin.dossiers.tableau_de_bord.nouvelle_procedure')
diff --git a/app/views/admin/procedures/new_from_existing.html.haml b/app/views/admin/procedures/new_from_existing.html.haml
index a226fd66a..3935e0722 100644
--- a/app/views/admin/procedures/new_from_existing.html.haml
+++ b/app/views/admin/procedures/new_from_existing.html.haml
@@ -1,3 +1,7 @@
+.row.white-back
+ %a#from-scratch{ href: new_admin_procedure_path, class: 'btn-sm btn-primary' }
+ Créer une nouvelle procédure de zéro
+
.row.white-back
%h2
Créer une nouvelle procédure à partir d'une procédure existante
@@ -15,8 +19,7 @@
%td{ style: 'width: 750px;' }
= procedure.libelle
%td{ style: 'padding-right: 10px; padding-left: 10px; width: 60px;' }
- - if !procedure.archivee?
- = link_to('Consulter', apercu_procedure_path(id: procedure.id), target: "_blank")
+ = link_to('Consulter', apercu_procedure_path(id: procedure.id), target: "_blank")
%td
= link_to('Cloner', admin_procedure_clone_path(procedure.id, from_new_from_existing: true), 'data-method' => :put, class: 'btn-sm btn-primary clone-btn')
%td{ style: 'padding-left: 10px;' }
diff --git a/app/views/layouts/_mailjet_newsletter.html.haml b/app/views/layouts/_mailjet_newsletter.html.haml
index 0cf468a00..e290caf30 100644
--- a/app/views/layouts/_mailjet_newsletter.html.haml
+++ b/app/views/layouts/_mailjet_newsletter.html.haml
@@ -1,2 +1,2 @@
%data.mj-w-data{ "data-apikey" => "1v5T", "data-base" => "https://app.mailjet.com", "data-height" => "328", "data-lang" => "fr_FR", "data-statics" => "statics", "data-token" => "11c89e7ddb46fbcdcb7f8fe5fdfca818", "data-w-id" => "39b", "data-width" => "640", "value" => "mj" }
-%script{ src: 'https://app.mailjet.com/statics/js/widget.modal.js', 'data-turbolinks-eval': 'false' }
+= javascript_include_tag 'mailjet', "data-turbolinks-eval": false
diff --git a/app/views/layouts/mailers/layout.html.erb b/app/views/layouts/mailers/layout.html.erb
index 6173e75fe..7f387ece8 100644
--- a/app/views/layouts/mailers/layout.html.erb
+++ b/app/views/layouts/mailers/layout.html.erb
@@ -50,7 +50,7 @@
-
+
|
diff --git a/app/views/shared/dossiers/editable_champs/_piece_justificative.html.haml b/app/views/shared/dossiers/editable_champs/_piece_justificative.html.haml
index b3855124a..c541ffdda 100644
--- a/app/views/shared/dossiers/editable_champs/_piece_justificative.html.haml
+++ b/app/views/shared/dossiers/editable_champs/_piece_justificative.html.haml
@@ -2,7 +2,7 @@
- if champ.type_de_champ.piece_justificative_template.attached?
%p.edit-pj-template.mb-1
- Veuillez télécharger, remplir et joindre le
+ Veuillez télécharger, remplir et joindre
= link_to('le modèle suivant', url_for(champ.type_de_champ.piece_justificative_template), target: '_blank')
- if !pj.attached?
diff --git a/config/application.rb b/config/application.rb
index 7d54fd628..6e5f62433 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -25,7 +25,7 @@ module TPS
config.autoload_paths += %W(#{config.root}/lib #{config.root}/app/validators #{config.root}/app/facades)
config.assets.paths << Rails.root.join('app', 'assets', 'javascript')
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
- config.assets.precompile += %w(.woff)
+ config.assets.precompile += %w(.woff mailjet.js)
if Rails.env.production?
URL = "https://www.demarches-simplifiees.fr/"
diff --git a/config/environments/production.rb b/config/environments/production.rb
index c27fd85c1..32972ab87 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -42,7 +42,7 @@ Rails.application.configure do
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
- # config.force_ssl = true
+ config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb
index 510cd60ea..7d9eb1124 100644
--- a/config/initializers/urls.rb
+++ b/config/initializers/urls.rb
@@ -1,7 +1,3 @@
-if Rails.env.production?
- API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2'
-else
- API_ENTREPRISE_URL = 'https://staging.entreprise.api.gouv.fr/v2'
-end
+API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2'
PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1'
diff --git a/db/migrate/20180423141411_add_test_started_at_to_procedures.rb b/db/migrate/20180423141411_add_test_started_at_to_procedures.rb
new file mode 100644
index 000000000..d42154c5e
--- /dev/null
+++ b/db/migrate/20180423141411_add_test_started_at_to_procedures.rb
@@ -0,0 +1,5 @@
+class AddTestStartedAtToProcedures < ActiveRecord::Migration[5.2]
+ def change
+ add_column :procedures, :test_started_at, :datetime, index: true
+ end
+end
diff --git a/db/migrate/20180515135415_add_aasm_state_to_procedures.rb b/db/migrate/20180515135415_add_aasm_state_to_procedures.rb
new file mode 100644
index 000000000..b290b0c08
--- /dev/null
+++ b/db/migrate/20180515135415_add_aasm_state_to_procedures.rb
@@ -0,0 +1,5 @@
+class AddAasmStateToProcedures < ActiveRecord::Migration[5.2]
+ def change
+ add_column :procedures, :aasm_state, :string, index: true, default: :brouillon
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index c1b888d2c..9594d9709 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2018_05_02_092852) do
+ActiveRecord::Schema.define(version: 2018_05_15_135415) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -464,6 +464,8 @@ ActiveRecord::Schema.define(version: 2018_05_02_092852) do
t.string "web_hook_url"
t.boolean "cloned_from_library", default: false
t.bigint "parent_procedure_id"
+ t.datetime "test_started_at"
+ t.string "aasm_state", default: "brouillon"
t.index ["hidden_at"], name: "index_procedures_on_hidden_at"
t.index ["parent_procedure_id"], name: "index_procedures_on_parent_procedure_id"
end
diff --git a/lib/tasks/2018_05_09_add_test_started_at_to_procedure.rake b/lib/tasks/2018_05_09_add_test_started_at_to_procedure.rake
new file mode 100644
index 000000000..198d1644d
--- /dev/null
+++ b/lib/tasks/2018_05_09_add_test_started_at_to_procedure.rake
@@ -0,0 +1,8 @@
+namespace :'2018_05_09_add_test_started_at_to_procedure' do
+ task set: :environment do
+ Procedure.publiees_ou_archivees.where(test_started_at: nil).find_each do |procedure|
+ procedure.test_started_at = procedure.published_at
+ procedure.save
+ end
+ end
+end
diff --git a/lib/tasks/2018_05_15_add_aasm_state_to_procedure.rake b/lib/tasks/2018_05_15_add_aasm_state_to_procedure.rake
new file mode 100644
index 000000000..6fbfdac81
--- /dev/null
+++ b/lib/tasks/2018_05_15_add_aasm_state_to_procedure.rake
@@ -0,0 +1,8 @@
+namespace :'2018_05_15_add_aasm_state_to_procedure' do
+ task set: :environment do
+ Procedure.archivees.update_all(aasm_state: :archivee)
+ Procedure.publiees.update_all(aasm_state: :publiee)
+ Procedure.brouillons.update_all(aasm_state: :brouillon)
+ Procedure.unscoped.where.not(hidden_at: nil).update_all(aasm_state: :hidden)
+ end
+end
diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb
index 53a550401..8eff31ad1 100644
--- a/spec/controllers/users/dossiers_controller_spec.rb
+++ b/spec/controllers/users/dossiers_controller_spec.rb
@@ -178,19 +178,19 @@ describe Users::DossiersController, type: :controller do
let(:user) { create(:user) }
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret_not_found}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret_not_found}?.*token=/)
.to_return(status: 404, body: 'fake body')
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
.to_return(status: status_entreprise_call, body: File.read('spec/support/files/etablissement.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
.to_return(status: status_entreprise_call, body: File.read('spec/support/files/entreprise.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
.to_return(status: exercices_status, body: exercices_body)
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
.to_return(status: rna_status, body: rna_body)
dossier
diff --git a/spec/features/admin/procedure_cloning_spec.rb b/spec/features/admin/procedure_cloning_spec.rb
index 8d8020641..149bf0242 100644
--- a/spec/features/admin/procedure_cloning_spec.rb
+++ b/spec/features/admin/procedure_cloning_spec.rb
@@ -11,6 +11,7 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
context 'Cloning procedure' do
before 'Create procedure' do
page.find_by_id('new-procedure').click
+ page.find_by_id('from-scratch').click
fill_in 'procedure_libelle', with: 'libelle de la procedure'
page.execute_script("$('#procedure_description').val('description de la procedure')")
fill_in 'procedure_organisation', with: 'organisme de la procedure'
diff --git a/spec/features/admin/procedure_creation_spec.rb b/spec/features/admin/procedure_creation_spec.rb
index 41a3a3f84..6599b832b 100644
--- a/spec/features/admin/procedure_creation_spec.rb
+++ b/spec/features/admin/procedure_creation_spec.rb
@@ -28,11 +28,13 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
context 'Creating a new procedure' do
scenario 'Finding new procedure link' do
page.find_by_id('new-procedure').click
+ page.find_by_id('from-scratch').click
expect(page).to have_current_path(new_admin_procedure_path)
end
scenario 'Finding save button for new procedure, libelle and description required' do
page.find_by_id('new-procedure').click
+ page.find_by_id('from-scratch').click
page.find_by_id('save-procedure').click
page.find_by_id('flash_message').visible?
fill_in 'procedure_libelle', with: 'libelle de la procedure'
@@ -46,6 +48,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
context 'Editing a new procedure' do
before 'Create procedure' do
page.find_by_id('new-procedure').click
+ page.find_by_id('from-scratch').click
fill_in 'procedure_libelle', with: 'libelle de la procedure'
page.execute_script("$('#procedure_description').val('description de la procedure')")
fill_in 'procedure_organisation', with: 'organisme de la procedure'
diff --git a/spec/features/users/complete_demande_spec.rb b/spec/features/users/complete_demande_spec.rb
index 5d8391174..25d639ae8 100644
--- a/spec/features/users/complete_demande_spec.rb
+++ b/spec/features/users/complete_demande_spec.rb
@@ -30,14 +30,14 @@ feature 'user path for dossier creation' do
end
context 'sets siret' do
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
.to_return(body: File.read('spec/support/files/etablissement.json', status: 200))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
.to_return(status: 404, body: '')
page.find_by_id('dossier-siret').set siret
diff --git a/spec/features/users/dossier_creation_spec.rb b/spec/features/users/dossier_creation_spec.rb
index 84572b3d5..6b15bf0a1 100644
--- a/spec/features/users/dossier_creation_spec.rb
+++ b/spec/features/users/dossier_creation_spec.rb
@@ -67,13 +67,13 @@ feature 'As a User I wanna create a dossier' do
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))
fill_in 'dossier-siret', with: siret
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
.to_return(status: 404, body: '')
page.find_by_id('dossier-siret').set siret
page.find_by_id('submit-siret').click
diff --git a/spec/features/users/start_demande_spec.rb b/spec/features/users/start_demande_spec.rb
index e1f141928..40aac6547 100644
--- a/spec/features/users/start_demande_spec.rb
+++ b/spec/features/users/start_demande_spec.rb
@@ -26,13 +26,13 @@ feature 'user arrive on siret page' do
end
context 'when enter a siret', js: true do
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
.to_return(status: 404, body: '')
page.find_by_id('dossier-siret').set siret
diff --git a/spec/jobs/find_dubious_procedures_job_spec.rb b/spec/jobs/find_dubious_procedures_job_spec.rb
index e8b354f99..8303b9d39 100644
--- a/spec/jobs/find_dubious_procedures_job_spec.rb
+++ b/spec/jobs/find_dubious_procedures_job_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
receive_procedure, receive_forbidden_tdcs = @dubious_procedures_args[0]
expect(receive_procedure).to eq(procedure)
- expect(receive_forbidden_tdcs).to match(forbidden_tdcs)
+ expect(receive_forbidden_tdcs).to match_array(forbidden_tdcs)
expect(AdministrationMailer).to have_received(:dubious_procedures).with(@dubious_procedures_args)
end
diff --git a/spec/lib/api_entreprise/api_spec.rb b/spec/lib/api_entreprise/api_spec.rb
index ded04e7d5..070568dba 100644
--- a/spec/lib/api_entreprise/api_spec.rb
+++ b/spec/lib/api_entreprise/api_spec.rb
@@ -5,7 +5,7 @@ describe ApiEntreprise::API do
describe '.entreprise' do
subject { described_class.entreprise(siren, procedure_id) }
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
.to_return(status: status, body: body)
end
context 'when siren does not exist' do
@@ -31,7 +31,7 @@ describe ApiEntreprise::API do
describe '.etablissement' do
subject { described_class.etablissement(siret, procedure_id) }
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
.to_return(status: status, body: body)
end
@@ -58,7 +58,7 @@ describe ApiEntreprise::API do
describe '.exercices' do
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/.*token=/)
.to_return(status: status, body: body)
end
@@ -89,7 +89,7 @@ describe ApiEntreprise::API do
describe '.rna' do
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/.*token=/)
.to_return(status: status, body: body)
end
diff --git a/spec/lib/api_entreprise/entreprise_adapter_spec.rb b/spec/lib/api_entreprise/entreprise_adapter_spec.rb
index af559f3ac..f9eaf62eb 100644
--- a/spec/lib/api_entreprise/entreprise_adapter_spec.rb
+++ b/spec/lib/api_entreprise/entreprise_adapter_spec.rb
@@ -7,7 +7,7 @@ describe ApiEntreprise::EntrepriseAdapter do
subject { adapter.to_params }
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
.to_return(body: File.read('spec/support/files/entreprise.json', status: 200))
end
diff --git a/spec/lib/api_entreprise/etablissement_adapter_spec.rb b/spec/lib/api_entreprise/etablissement_adapter_spec.rb
index e9a3a5c02..31f21414a 100644
--- a/spec/lib/api_entreprise/etablissement_adapter_spec.rb
+++ b/spec/lib/api_entreprise/etablissement_adapter_spec.rb
@@ -8,7 +8,7 @@ describe ApiEntreprise::EtablissementAdapter do
subject { described_class.new(siret, procedure_id).to_params }
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
.to_return(body: File.read('spec/support/files/etablissement.json', status: 200))
end
@@ -75,7 +75,7 @@ describe ApiEntreprise::EtablissementAdapter do
subject { described_class.new(bad_siret, 12).to_params }
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/etablissements\/#{bad_siret}?.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{bad_siret}?.*token=/)
.to_return(body: 'Fake body', status: 404)
end
diff --git a/spec/lib/api_entreprise/exercices_adapter_spec.rb b/spec/lib/api_entreprise/exercices_adapter_spec.rb
index 4feec27da..bdfe2c7da 100644
--- a/spec/lib/api_entreprise/exercices_adapter_spec.rb
+++ b/spec/lib/api_entreprise/exercices_adapter_spec.rb
@@ -6,7 +6,7 @@ describe ApiEntreprise::ExercicesAdapter do
subject { described_class.new(siret, procedure_id).to_params }
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/.*token=/)
.to_return(body: File.read('spec/support/files/exercices.json', status: 200))
end
diff --git a/spec/lib/api_entreprise/rna_adapter_spec.rb b/spec/lib/api_entreprise/rna_adapter_spec.rb
index 7edbcb2aa..2df856cbe 100644
--- a/spec/lib/api_entreprise/rna_adapter_spec.rb
+++ b/spec/lib/api_entreprise/rna_adapter_spec.rb
@@ -10,7 +10,7 @@ describe ApiEntreprise::RNAAdapter do
subject { adapter.to_params }
before do
- stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/.*token=/)
+ stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/.*token=/)
.to_return(body: body, status: status)
end