Merge branch 'dev'
This commit is contained in:
commit
22bef7bf99
32 changed files with 214 additions and 49 deletions
2
Gemfile
2
Gemfile
|
@ -99,6 +99,8 @@ gem 'sanitize-url'
|
||||||
|
|
||||||
gem 'flipflop'
|
gem 'flipflop'
|
||||||
|
|
||||||
|
gem 'aasm'
|
||||||
|
|
||||||
# Cron jobs
|
# Cron jobs
|
||||||
gem 'delayed_job_active_record'
|
gem 'delayed_job_active_record'
|
||||||
gem "daemons"
|
gem "daemons"
|
||||||
|
|
|
@ -29,6 +29,8 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
CFPropertyList (2.3.6)
|
CFPropertyList (2.3.6)
|
||||||
|
aasm (4.12.3)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
actioncable (5.2.0)
|
actioncable (5.2.0)
|
||||||
actionpack (= 5.2.0)
|
actionpack (= 5.2.0)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
|
@ -779,6 +781,7 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
aasm
|
||||||
active_model_serializers
|
active_model_serializers
|
||||||
administrate
|
administrate
|
||||||
apipie-rails
|
apipie-rails
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Context
|
## 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
|
## Dépendances
|
||||||
|
|
BIN
app/assets/images/mailer/gestionnaire_mailer/logo.png
Executable file → Normal file
BIN
app/assets/images/mailer/gestionnaire_mailer/logo.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 6.6 KiB |
132
app/assets/javascripts/mailjet.js
Normal file
132
app/assets/javascripts/mailjet.js
Normal file
|
@ -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 = "<div id=\"mj-w-overlay\" style=\"display: none;\">" +
|
||||||
|
"<div id=\"mj-w-popin-block\" style=\"max-width:" + width + "px; max-height:" + height + "px\">" +
|
||||||
|
"<div id=\"mj-w-loader\"></div>" +
|
||||||
|
"<img id=\"mj-w-close-img\" alt=\"" + i8nMessages[locale]['close-popin'] + "\" title=\"" + i8nMessages[locale]['close-popin'] + "\" src=\"" + base + "/images/w-popin-close.png\" style=\"display:none;\" />" +
|
||||||
|
"<iframe id=\"mj-w-iframe\" src=\"" + base + "/widget/iframe/" + apiKey + "/" + wId + "\" scrolling=\"no\" width=\"100% \" frameborder=\"0\" allotransparency=\"true\" style=\"background-color:transparent; border-radius:3px;height: 0px;\">" +
|
||||||
|
"<p>" + i8nMessages[locale]['iframe-error'] + "</p>" +
|
||||||
|
"</iframe>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>";
|
||||||
|
|
||||||
|
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%';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
|
@ -63,7 +63,7 @@ class Procedure < ApplicationRecord
|
||||||
|
|
||||||
def hide!
|
def hide!
|
||||||
now = DateTime.now
|
now = DateTime.now
|
||||||
self.update(hidden_at: now)
|
self.update(hidden_at: now, aasm_state: :hidden)
|
||||||
self.dossiers.update_all(hidden_at: now)
|
self.dossiers.update_all(hidden_at: now)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -153,7 +153,8 @@ class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish!(path)
|
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)
|
ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -162,7 +163,7 @@ class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive
|
def archive
|
||||||
self.update!(archived_at: Time.now)
|
self.update!(archived_at: Time.now, aasm_state: :archivee)
|
||||||
end
|
end
|
||||||
|
|
||||||
def archivee?
|
def archivee?
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
.carret-right
|
.carret-right
|
||||||
.carret-down
|
.carret-down
|
||||||
Procédures
|
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
|
#new-procedure.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
||||||
Nouvelle
|
Nouvelle
|
||||||
|
|
||||||
|
|
|
@ -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
|
.row.white-back
|
||||||
%h2
|
%h2
|
||||||
= t('dynamics.admin.dossiers.tableau_de_bord.nouvelle_procedure')
|
= t('dynamics.admin.dossiers.tableau_de_bord.nouvelle_procedure')
|
||||||
|
|
|
@ -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
|
.row.white-back
|
||||||
%h2
|
%h2
|
||||||
Créer une nouvelle procédure à partir d'une procédure existante
|
Créer une nouvelle procédure à partir d'une procédure existante
|
||||||
|
@ -15,7 +19,6 @@
|
||||||
%td{ style: 'width: 750px;' }
|
%td{ style: 'width: 750px;' }
|
||||||
= procedure.libelle
|
= procedure.libelle
|
||||||
%td{ style: 'padding-right: 10px; padding-left: 10px; width: 60px;' }
|
%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
|
%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')
|
= link_to('Cloner', admin_procedure_clone_path(procedure.id, from_new_from_existing: true), 'data-method' => :put, class: 'btn-sm btn-primary clone-btn')
|
||||||
|
|
|
@ -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" }
|
%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
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td style="word-wrap:break-word;font-size:0px;padding:0;padding-top:0px;padding-bottom:0px;" align="left">
|
<td style="word-wrap:break-word;font-size:0px;padding:0;padding-top:0px;padding-bottom:0px;" align="left">
|
||||||
<div class="" style="cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:22px;text-align:left;">
|
<div class="" style="cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:22px;text-align:left;">
|
||||||
<img align="middle" alt="Logo demarches-simplifiees.fr" src="<%= image_url('mailer/gestionnaire_mailer/logo.png') %>" style="max-width=125px; padding=30px 0; display=inline !important; vertical-align=bottom; border=0; height=auto; outline=none; text-decoration=none; -ms-interpolation-mode=bicubic;" />
|
<img align="middle" alt="Logo demarches-simplifiees.fr" src="<%= image_url('mailer/gestionnaire_mailer/logo.png') %>" style="max-width=600px; padding=30px 0; display=inline !important; vertical-align=bottom; border=0; height=auto; outline=none; text-decoration=none; -ms-interpolation-mode=bicubic;" />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
- if champ.type_de_champ.piece_justificative_template.attached?
|
- if champ.type_de_champ.piece_justificative_template.attached?
|
||||||
%p.edit-pj-template.mb-1
|
%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')
|
= link_to('le modèle suivant', url_for(champ.type_de_champ.piece_justificative_template), target: '_blank')
|
||||||
|
|
||||||
- if !pj.attached?
|
- if !pj.attached?
|
||||||
|
|
|
@ -25,7 +25,7 @@ module TPS
|
||||||
config.autoload_paths += %W(#{config.root}/lib #{config.root}/app/validators #{config.root}/app/facades)
|
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', 'javascript')
|
||||||
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
|
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?
|
if Rails.env.production?
|
||||||
URL = "https://www.demarches-simplifiees.fr/"
|
URL = "https://www.demarches-simplifiees.fr/"
|
||||||
|
|
|
@ -42,7 +42,7 @@ Rails.application.configure do
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
# 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.
|
# 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
|
# Use the lowest log level to ensure availability of diagnostic information
|
||||||
# when problems arise.
|
# when problems arise.
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
if Rails.env.production?
|
|
||||||
API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2'
|
API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2'
|
||||||
else
|
|
||||||
API_ENTREPRISE_URL = 'https://staging.entreprise.api.gouv.fr/v2'
|
|
||||||
end
|
|
||||||
|
|
||||||
PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1'
|
PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1'
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddTestStartedAtToProcedures < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :procedures, :test_started_at, :datetime, index: true
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddAasmStateToProcedures < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :procedures, :aasm_state, :string, index: true, default: :brouillon
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -464,6 +464,8 @@ ActiveRecord::Schema.define(version: 2018_05_02_092852) do
|
||||||
t.string "web_hook_url"
|
t.string "web_hook_url"
|
||||||
t.boolean "cloned_from_library", default: false
|
t.boolean "cloned_from_library", default: false
|
||||||
t.bigint "parent_procedure_id"
|
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 ["hidden_at"], name: "index_procedures_on_hidden_at"
|
||||||
t.index ["parent_procedure_id"], name: "index_procedures_on_parent_procedure_id"
|
t.index ["parent_procedure_id"], name: "index_procedures_on_parent_procedure_id"
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
8
lib/tasks/2018_05_15_add_aasm_state_to_procedure.rake
Normal file
8
lib/tasks/2018_05_15_add_aasm_state_to_procedure.rake
Normal file
|
@ -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
|
|
@ -178,19 +178,19 @@ describe Users::DossiersController, type: :controller do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
before do
|
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')
|
.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'))
|
.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'))
|
.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)
|
.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)
|
.to_return(status: rna_status, body: rna_body)
|
||||||
|
|
||||||
dossier
|
dossier
|
||||||
|
|
|
@ -11,6 +11,7 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
|
||||||
context 'Cloning procedure' do
|
context 'Cloning procedure' do
|
||||||
before 'Create procedure' do
|
before 'Create procedure' do
|
||||||
page.find_by_id('new-procedure').click
|
page.find_by_id('new-procedure').click
|
||||||
|
page.find_by_id('from-scratch').click
|
||||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||||
page.execute_script("$('#procedure_description').val('description de la procedure')")
|
page.execute_script("$('#procedure_description').val('description de la procedure')")
|
||||||
fill_in 'procedure_organisation', with: 'organisme de la procedure'
|
fill_in 'procedure_organisation', with: 'organisme de la procedure'
|
||||||
|
|
|
@ -28,11 +28,13 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
||||||
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
|
||||||
|
page.find_by_id('from-scratch').click
|
||||||
expect(page).to have_current_path(new_admin_procedure_path)
|
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
|
||||||
page.find_by_id('new-procedure').click
|
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('save-procedure').click
|
||||||
page.find_by_id('flash_message').visible?
|
page.find_by_id('flash_message').visible?
|
||||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
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
|
context 'Editing a new procedure' do
|
||||||
before 'Create procedure' do
|
before 'Create procedure' do
|
||||||
page.find_by_id('new-procedure').click
|
page.find_by_id('new-procedure').click
|
||||||
|
page.find_by_id('from-scratch').click
|
||||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||||
page.execute_script("$('#procedure_description').val('description de la procedure')")
|
page.execute_script("$('#procedure_description').val('description de la procedure')")
|
||||||
fill_in 'procedure_organisation', with: 'organisme de la procedure'
|
fill_in 'procedure_organisation', with: 'organisme de la procedure'
|
||||||
|
|
|
@ -30,14 +30,14 @@ feature 'user path for dossier creation' do
|
||||||
end
|
end
|
||||||
context 'sets siret' do
|
context 'sets siret' do
|
||||||
before 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))
|
.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'))
|
.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'))
|
.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: '')
|
.to_return(status: 404, body: '')
|
||||||
|
|
||||||
page.find_by_id('dossier-siret').set siret
|
page.find_by_id('dossier-siret').set siret
|
||||||
|
|
|
@ -67,13 +67,13 @@ feature 'As a User I wanna create a dossier' do
|
||||||
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))
|
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=/)
|
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
|
||||||
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
|
.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'))
|
.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'))
|
.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: '')
|
.to_return(status: 404, body: '')
|
||||||
page.find_by_id('dossier-siret').set siret
|
page.find_by_id('dossier-siret').set siret
|
||||||
page.find_by_id('submit-siret').click
|
page.find_by_id('submit-siret').click
|
||||||
|
|
|
@ -26,13 +26,13 @@ feature 'user arrive on siret page' do
|
||||||
end
|
end
|
||||||
context 'when enter a siret', js: true do
|
context 'when enter a siret', js: true do
|
||||||
before 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'))
|
.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'))
|
.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'))
|
.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: '')
|
.to_return(status: 404, body: '')
|
||||||
|
|
||||||
page.find_by_id('dossier-siret').set siret
|
page.find_by_id('dossier-siret').set siret
|
||||||
|
|
|
@ -29,7 +29,7 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
|
||||||
receive_procedure, receive_forbidden_tdcs = @dubious_procedures_args[0]
|
receive_procedure, receive_forbidden_tdcs = @dubious_procedures_args[0]
|
||||||
|
|
||||||
expect(receive_procedure).to eq(procedure)
|
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)
|
expect(AdministrationMailer).to have_received(:dubious_procedures).with(@dubious_procedures_args)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe ApiEntreprise::API do
|
||||||
describe '.entreprise' do
|
describe '.entreprise' do
|
||||||
subject { described_class.entreprise(siren, procedure_id) }
|
subject { described_class.entreprise(siren, procedure_id) }
|
||||||
before do
|
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)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
context 'when siren does not exist' do
|
context 'when siren does not exist' do
|
||||||
|
@ -31,7 +31,7 @@ describe ApiEntreprise::API do
|
||||||
describe '.etablissement' do
|
describe '.etablissement' do
|
||||||
subject { described_class.etablissement(siret, procedure_id) }
|
subject { described_class.etablissement(siret, procedure_id) }
|
||||||
before 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: status, body: body)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ describe ApiEntreprise::API do
|
||||||
|
|
||||||
describe '.exercices' do
|
describe '.exercices' do
|
||||||
before 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)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ describe ApiEntreprise::API do
|
||||||
|
|
||||||
describe '.rna' do
|
describe '.rna' do
|
||||||
before 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)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe ApiEntreprise::EntrepriseAdapter do
|
||||||
subject { adapter.to_params }
|
subject { adapter.to_params }
|
||||||
|
|
||||||
before do
|
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))
|
.to_return(body: File.read('spec/support/files/entreprise.json', status: 200))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe ApiEntreprise::EtablissementAdapter do
|
||||||
subject { described_class.new(siret, procedure_id).to_params }
|
subject { described_class.new(siret, procedure_id).to_params }
|
||||||
|
|
||||||
before 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))
|
.to_return(body: File.read('spec/support/files/etablissement.json', status: 200))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ describe ApiEntreprise::EtablissementAdapter do
|
||||||
subject { described_class.new(bad_siret, 12).to_params }
|
subject { described_class.new(bad_siret, 12).to_params }
|
||||||
|
|
||||||
before do
|
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)
|
.to_return(body: 'Fake body', status: 404)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe ApiEntreprise::ExercicesAdapter do
|
||||||
subject { described_class.new(siret, procedure_id).to_params }
|
subject { described_class.new(siret, procedure_id).to_params }
|
||||||
|
|
||||||
before 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(body: File.read('spec/support/files/exercices.json', status: 200))
|
.to_return(body: File.read('spec/support/files/exercices.json', status: 200))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ describe ApiEntreprise::RNAAdapter do
|
||||||
subject { adapter.to_params }
|
subject { adapter.to_params }
|
||||||
|
|
||||||
before 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(body: body, status: status)
|
.to_return(body: body, status: status)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue