Merge branch 'develop' into staging

This commit is contained in:
Xavier J 2016-09-16 17:19:51 +02:00
commit 8c5875a36c
10 changed files with 31 additions and 22 deletions

View file

@ -50,7 +50,7 @@ gem 'will_paginate-bootstrap'
gem 'draper' gem 'draper'
#Gestion des comptes utilisateurs #Gestion des comptes utilisateurs
gem 'devise' gem 'devise', '~> 3.0'
gem 'openid_connect' gem 'openid_connect'
gem 'rest-client' gem 'rest-client'

View file

@ -62,7 +62,7 @@ GEM
autoprefixer-rails (5.2.1) autoprefixer-rails (5.2.1)
execjs execjs
json json
bcrypt (3.1.10) bcrypt (3.1.11)
bindata (2.1.0) bindata (2.1.0)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
@ -119,7 +119,7 @@ GEM
debug_inspector (0.0.2) debug_inspector (0.0.2)
deep_cloneable (2.2.1) deep_cloneable (2.2.1)
activerecord (>= 3.1.0, < 5.2.0) activerecord (>= 3.1.0, < 5.2.0)
devise (3.4.1) devise (3.5.10)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 3.2.6, < 5)
@ -141,7 +141,7 @@ GEM
erubis (2.7.0) erubis (2.7.0)
eventmachine (1.0.8) eventmachine (1.0.8)
excon (0.49.0) excon (0.49.0)
execjs (2.5.2) execjs (2.7.0)
factory_girl (4.5.0) factory_girl (4.5.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
faraday (0.9.1) faraday (0.9.1)
@ -461,8 +461,8 @@ GEM
json (~> 1.4) json (~> 1.4)
ref (2.0.0) ref (2.0.0)
request_store (1.1.0) request_store (1.1.0)
responders (2.1.0) responders (2.3.0)
railties (>= 4.2.0, < 5) railties (>= 4.2.0, < 5.1)
rest-client (1.8.0) rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0) mime-types (>= 1.16, < 3.0)
@ -574,9 +574,8 @@ GEM
coffee-rails coffee-rails
tzinfo (1.2.2) tzinfo (1.2.2)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (2.7.1) uglifier (3.0.2)
execjs (>= 0.3.0) execjs (>= 0.3.0, < 3)
json (>= 1.8.0)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.1) unf_ext (0.0.7.1)
@ -592,7 +591,7 @@ GEM
activemodel (>= 3.0.0) activemodel (>= 3.0.0)
addressable addressable
vcr (3.0.1) vcr (3.0.1)
warden (1.2.3) warden (1.2.6)
rack (>= 1.0) rack (>= 1.0)
web-console (2.2.1) web-console (2.2.1)
activemodel (>= 4.0) activemodel (>= 4.0)
@ -636,7 +635,7 @@ DEPENDENCIES
coffee-rails (~> 4.1.0) coffee-rails (~> 4.1.0)
database_cleaner database_cleaner
deep_cloneable (~> 2.2.1) deep_cloneable (~> 2.2.1)
devise devise (~> 3.0)
draper draper
factory_girl factory_girl
fog fog

View file

@ -23,7 +23,12 @@ function the_terms() {
} }
function error_form_siret(invalid_siret){ function error_form_siret(invalid_siret){
$("input[type='submit']").removeClass('btn-success').addClass('btn-danger').val('Erreur SIRET'); setTimeout(function(){
$("input[type='submit']").val('Erreur SIRET');
}, 10);
$("input[type='submit']").removeClass('btn-success').addClass('btn-danger');
$("#dossier_siret").addClass('input-error').val(invalid_siret).on('input', reset_form_siret); $("#dossier_siret").addClass('input-error').val(invalid_siret).on('input', reset_form_siret);
} }

View file

@ -13,9 +13,13 @@ class DossierService
raise RestClient::ResourceNotFound raise RestClient::ResourceNotFound
end end
@dossier.create_entreprise(@entreprise_adapter.to_params)
@etablissement_adapter = SIADE::EtablissementAdapter.new(@siret) @etablissement_adapter = SIADE::EtablissementAdapter.new(@siret)
if @etablissement_adapter.to_params.nil?
raise RestClient::ResourceNotFound
end
@dossier.create_entreprise(@entreprise_adapter.to_params)
@dossier.create_etablissement(@etablissement_adapter.to_params) @dossier.create_etablissement(@etablissement_adapter.to_params)
@rna_adapter = SIADE::RNAAdapter.new(@siret) @rna_adapter = SIADE::RNAAdapter.new(@siret)

View file

@ -21,4 +21,5 @@
- unless @facade.procedure.lien_site_web.blank? - unless @facade.procedure.lien_site_web.blank?
.center .center
=link_to 'En savoir plus ...', @facade.procedure.lien_site_web, {target: '_blank'} %a{href: "#{@facade.procedure.lien_site_web.html_safe}", target: '_blank'}
En savoir plus ...

View file

@ -1 +1 @@
<%= (MailTemplate.replace_tags @dossier.procedure.mail_received.body, @dossier).html_safe %> <%= escape_once (MailTemplate.replace_tags @dossier.procedure.mail_received.body, @dossier).html_safe %>

View file

@ -1 +1 @@
remote_storage: false remote_storage: true

View file

@ -18,6 +18,8 @@ class SIADE::EtablissementAdapter
params[k] = v if address_attribut_to_fetch.include?(k) params[k] = v if address_attribut_to_fetch.include?(k)
end end
params params
rescue
nil
end end
def attr_to_fetch def attr_to_fetch

View file

@ -285,7 +285,7 @@ shared_examples 'description_controller_spec_POST_piece_justificatives_for_owner
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0, 'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} } 'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} }
context 'when user is the owner' do context 'when user is the owner', vcr: {cassette_name: 'controllers_users_description_controller_pieces_justificatives'} do
before do before do
sign_in user sign_in user
end end

View file

@ -7,7 +7,7 @@ describe SIADE::EtablissementAdapter do
before do before do
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}") stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
.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
it '#to_params class est une Hash ?' do it '#to_params class est une Hash ?' do
@ -74,11 +74,9 @@ describe SIADE::EtablissementAdapter do
before do before do
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{bad_siret}?token=#{SIADETOKEN}") stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{bad_siret}?token=#{SIADETOKEN}")
.to_return(body: 'Fake body', status: 404) .to_return(body: 'Fake body', status: 404)
end end
it 'raises exception RestClient::ResourceNotFound' do it { expect(subject).to be_nil }
expect { subject }.to raise_error(RestClient::ResourceNotFound)
end
end end
end end