- Code review
- Delete Mandataires sociaux adapter - Add function to get mandataires sociaux in Enterprise Adapter
This commit is contained in:
parent
e0d980e804
commit
e8fd212d13
14 changed files with 121 additions and 138 deletions
|
@ -81,28 +81,20 @@ describe FranceConnect::ParticulierController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
let(:email) { 'plop@gmail.com' }
|
||||
|
||||
subject { post :create, user: user_info }
|
||||
|
||||
context 'when email is filled' do
|
||||
it { expect { subject }.to change { User.count }.by(1) }
|
||||
let(:email) { 'plop@gmail.com' }
|
||||
|
||||
it 'redirects user root page' do
|
||||
subject
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it { expect { subject }.to change { User.count }.by(1) }
|
||||
it { expect(subject).to redirect_to(root_path) }
|
||||
end
|
||||
|
||||
context 'when email is incorrect' do
|
||||
let(:email) { '' }
|
||||
|
||||
it { expect { subject }.to change { User.count }.by(0) }
|
||||
|
||||
it 'redirect to check email FC page' do
|
||||
subject
|
||||
expect(response).to redirect_to(france_connect_particulier_new_path(user: user_info))
|
||||
end
|
||||
it { expect(subject).to redirect_to(france_connect_particulier_new_path(user: user_info)) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ describe Users::RegistrationsController, type: :controller do
|
|||
context 'when user is correct' do
|
||||
it { expect(described_class).to be < Devise::RegistrationsController }
|
||||
|
||||
it 'welcome email is send' do
|
||||
it 'sends welcome email' do
|
||||
expect(WelcomeMailer).to receive(:welcome_email).and_return(WelcomeMailer)
|
||||
expect(WelcomeMailer).to receive(:deliver_now!)
|
||||
|
||||
|
@ -28,7 +28,7 @@ describe Users::RegistrationsController, type: :controller do
|
|||
context 'when user is not correct' do
|
||||
let(:user) { {email: '', password: password, password_confirmation: password} }
|
||||
|
||||
it 'welcome email is not send' do
|
||||
it 'not sends welcome email' do
|
||||
expect(WelcomeMailer).not_to receive(:welcome_email)
|
||||
|
||||
subject
|
||||
|
|
|
@ -12,7 +12,13 @@ feature 'France Connect Particulier Connexion' do
|
|||
let(:know_france_connect_particulier_id) { 'blabla' }
|
||||
let(:unknow_france_connect_particulier_id) { 'titi' }
|
||||
|
||||
let(:user_info) { Hashie::Mash.new(france_connect_particulier_id: france_connect_particulier_id, given_name: given_name, family_name: family_name, birthdate: birthdate, birthplace: birthplace, gender: gender, email: email) }
|
||||
let(:user_info) { Hashie::Mash.new(france_connect_particulier_id: france_connect_particulier_id,
|
||||
given_name: given_name,
|
||||
family_name: family_name,
|
||||
birthdate: birthdate,
|
||||
birthplace: birthplace,
|
||||
gender: gender,
|
||||
email: email) }
|
||||
|
||||
context 'when user is on login page' do
|
||||
|
||||
|
@ -28,7 +34,13 @@ feature 'France Connect Particulier Connexion' do
|
|||
let(:code) { 'plop' }
|
||||
|
||||
context 'when authentification is ok' do
|
||||
let!(:user) { create(:user, france_connect_particulier_id: know_france_connect_particulier_id, given_name: given_name, family_name: family_name, birthdate: birthdate, birthplace: birthplace, gender: gender) }
|
||||
let!(:user) { create(:user,
|
||||
france_connect_particulier_id: know_france_connect_particulier_id,
|
||||
given_name: given_name,
|
||||
family_name: family_name,
|
||||
birthdate: birthdate,
|
||||
birthplace: birthplace,
|
||||
gender: gender) }
|
||||
|
||||
before do
|
||||
allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_uri).and_return(france_connect_particulier_callback_path(code: code))
|
||||
|
|
|
@ -5,7 +5,7 @@ describe SIADE::EntrepriseAdapter do
|
|||
|
||||
before do
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/api/v1/entreprises/418166096?token=#{SIADETOKEN}")
|
||||
.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
|
||||
|
||||
it '#to_params class est une Hash ?' do
|
||||
|
@ -61,4 +61,35 @@ describe SIADE::EntrepriseAdapter do
|
|||
expect(subject[:prenom]).to eq('test_prenom')
|
||||
end
|
||||
end
|
||||
|
||||
context 'Mandataire sociaux' do
|
||||
subject { described_class.new('418166096').mandataires_sociaux }
|
||||
|
||||
it '#to_params class est une Hash ?' do
|
||||
expect(subject).to be_an_instance_of(Array)
|
||||
end
|
||||
|
||||
it { expect(subject.size).to eq(8) }
|
||||
|
||||
describe 'Attributs' do
|
||||
it 'Un mandataire social possède bien un nom' do
|
||||
expect(subject[0][:nom]).to eq('HISQUIN')
|
||||
end
|
||||
it 'Un mandataire social possède bien un prenom' do
|
||||
expect(subject[0][:prenom]).to eq('FRANCOIS')
|
||||
end
|
||||
|
||||
it 'Un mandataire social possède bien une fonction' do
|
||||
expect(subject[0][:fonction]).to eq('PRESIDENT DU DIRECTOIRE')
|
||||
end
|
||||
|
||||
it 'Un mandataire social possède bien une date de naissance' do
|
||||
expect(subject[0][:date_naissance]).to eq('1965-01-27')
|
||||
end
|
||||
|
||||
it 'Un mandataire social possède bien une date de naissance au format timestamp' do
|
||||
expect(subject[0][:date_naissance_timestamp]).to eq(-155523600)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe SIADE::MandatairesSociauxAdapter do
|
||||
subject { described_class.new('418166096').to_params }
|
||||
|
||||
before do
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/api/v1/entreprises/418166096?token=#{SIADETOKEN}")
|
||||
.to_return(body: File.read('spec/support/files/entreprise.json', status: 200))
|
||||
end
|
||||
|
||||
it '#to_params class est une Hash ?' do
|
||||
expect(subject).to be_an_instance_of(Hash)
|
||||
end
|
||||
|
||||
describe 'Mandataires Sociaux' do
|
||||
|
||||
it { expect(subject.size).to eq(8) }
|
||||
|
||||
describe 'Attributs' do
|
||||
|
||||
it 'Un mandataire social possède bien un nom' do
|
||||
expect(subject[0][:nom]).to eq('HISQUIN')
|
||||
end
|
||||
it 'Un mandataire social possède bien un prenom' do
|
||||
expect(subject[0][:prenom]).to eq('FRANCOIS')
|
||||
end
|
||||
|
||||
it 'Un mandataire social possède bien une fonction' do
|
||||
expect(subject[0][:fonction]).to eq('PRESIDENT DU DIRECTOIRE')
|
||||
end
|
||||
|
||||
it 'Un mandataire social possède bien une date de naissance' do
|
||||
expect(subject[0][:date_naissance]).to eq('1965-01-27')
|
||||
end
|
||||
|
||||
it 'Un mandataire social possède bien une date de naissance au format timestamp' do
|
||||
expect(subject[0][:date_naissance_timestamp]).to eq(-155523600)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -21,4 +21,13 @@ describe Etablissement do
|
|||
it { is_expected.to belong_to(:entreprise) }
|
||||
it { is_expected.to have_many(:exercices) }
|
||||
end
|
||||
|
||||
describe '#geo_adresse' do
|
||||
|
||||
let(:etablissement) { create(:etablissement) }
|
||||
|
||||
subject { etablissement.geo_adresse }
|
||||
|
||||
it { is_expected.to eq '6 RUE RAOUL NORDLING IMMEUBLE BORA 92270 BOIS COLOMBES' }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,6 +5,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
|
||||
let!(:dossier) { create(:dossier, :with_procedure, user: user, state: 'initiated', nom_projet: 'projet de test').decorate }
|
||||
let!(:dossier_2) { create(:dossier, :with_procedure, user: user, state: 'replied', nom_projet: 'projet répondu').decorate }
|
||||
let!(:dossier_3) { create(:dossier, :with_procedure, user: user, state: 'replied', nom_projet: 'projet répondu 2').decorate }
|
||||
let!(:dossier_termine) { create(:dossier, :with_procedure, user: user, state: 'closed').decorate }
|
||||
|
||||
describe 'params liste is a_traiter' do
|
||||
|
@ -18,6 +19,10 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
partial: "users/dossiers/list",
|
||||
array: true))
|
||||
assign(:liste, 'a_traiter')
|
||||
assign(:dossiers_a_traiter_total, '1')
|
||||
assign(:dossiers_en_attente_total, '2')
|
||||
assign(:dossiers_termine_total, '1')
|
||||
|
||||
render
|
||||
end
|
||||
|
||||
|
@ -36,6 +41,12 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
it { is_expected.not_to have_content(dossier.nom_projet) }
|
||||
it { is_expected.not_to have_content(dossier_termine.nom_projet) }
|
||||
end
|
||||
|
||||
describe 'badges on tabs' do
|
||||
it { is_expected.to have_content('À traiter 1') }
|
||||
it { is_expected.to have_content('En attente 2') }
|
||||
it { is_expected.to have_content('Terminé 1') }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'params liste is en_attente' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue