Merge branch 'develop' of github.com:sgmap/tps into develop

Conflicts:
	db/schema.rb
This commit is contained in:
Tanguy PATTE 2016-01-25 16:09:46 +01:00
commit 6d5f00deb9
34 changed files with 884 additions and 193 deletions

View file

@ -8,7 +8,7 @@ describe FranceConnect::ParticulierController, type: :controller do
let(:gender) { 'M' }
let(:birthplace) { '1234' }
let(:france_connect_particulier_id) { 'blabla' }
let(:email) { '' }
let(:email) { 'test@test.com' }
let(:password) { '' }
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, password: password) }
@ -32,33 +32,80 @@ describe FranceConnect::ParticulierController, type: :controller do
context 'when code is correct' do
before do
allow(FranceConnectService).to receive(:retrieve_user_informations_particulier).and_return(user_info)
get :callback, code: code
end
context 'when france_connect_particulier_id exist in database' do
before do
create(:user, france_connect_particulier_id: france_connect_particulier_id, email: email, given_name: given_name, family_name: family_name, birthdate: birthdate, gender: gender, birthplace: birthplace)
get :callback, code: code
let!(:france_connect_information) { create(:france_connect_information, france_connect_particulier_id: france_connect_particulier_id, given_name: given_name, family_name: family_name, birthdate: birthdate, gender: gender, birthplace: birthplace) }
context {
subject { get :callback, code: code }
it 'does not create a new france_connect_information in database' do
expect { subject }.not_to change { FranceConnectInformation.count }
end
}
context 'when france_connect_particulier_id have an associate user' do
before do
create(:user, email: email, france_connect_information: france_connect_information)
get :callback, code: code
end
let(:email) { 'plop@plop.com' }
let(:current_user) { User.find_by_email(email) }
let(:stored_location) { '/plip/plop' }
it 'current user have attribut loged_in_with_france_connect? at true' do
expect(current_user.loged_in_with_france_connect?).to be_truthy
end
it 'redirect to stored location' do
subject.store_location_for(:user, stored_location)
get :callback, code: code
expect(response).to redirect_to(stored_location)
end
end
let(:email) { 'plop@plop.com' }
let(:current_user) { User.find_by_email(email) }
let(:stored_location) { '/plip/plop' }
context 'when france_connect_particulier_id does not have an associate user' do
let(:salt) { FranceConnectSaltService.new(france_connect_information).salt }
it 'current user have attribut loged_in_with_france_connect? at true' do
expect(current_user.loged_in_with_france_connect?).to be_truthy
end
before do
get :callback, code: code
end
it 'redirect to stored location' do
subject.store_location_for(:user, stored_location)
get :callback, code: code
expect(response).to redirect_to(stored_location)
it 'redirects to check email FC page' do
expect(response).to redirect_to(france_connect_particulier_new_path(fci_id: france_connect_information.id, salt: salt))
end
end
end
context 'when france_connect_particulier_id does not exist in database' do
let(:last_france_connect_information) { FranceConnectInformation.last }
let(:salt) { FranceConnectSaltService.new(last_france_connect_information).salt }
subject { get :callback, code: code }
it { expect { subject }.to change { FranceConnectInformation.count }.by(1) }
describe 'FranceConnectInformation attributs' do
before do
get :callback, code: code
end
subject { last_france_connect_information }
it { expect(subject.gender).to eq gender }
it { expect(subject.given_name).to eq given_name }
it { expect(subject.family_name).to eq family_name }
it { expect(subject.email_france_connect).to eq email }
it { expect(subject.birthdate.to_time.to_i).to eq birthdate.to_time.to_i }
it { expect(subject.birthplace).to eq birthplace }
it { expect(subject.france_connect_particulier_id).to eq france_connect_particulier_id }
end
it 'redirects to check email FC page' do
expect(response).to redirect_to(france_connect_particulier_new_path(user: user_info))
expect(subject).to redirect_to(france_connect_particulier_new_path(fci_id: last_france_connect_information.id, salt: salt))
end
end
end
@ -80,8 +127,85 @@ describe FranceConnect::ParticulierController, type: :controller do
end
end
describe 'POST #check_email' do
let(:email) { 'plop@gmail.com' }
let!(:france_connect_information) { create(:france_connect_information) }
let(:france_connect_information_id) { france_connect_information.id }
let(:salt) { FranceConnectSaltService.new(france_connect_information).salt }
subject { post :check_email, fci_id: france_connect_information_id, salt: salt, user: {email_france_connect: email} }
context 'when salt and fci_id does not matches' do
let(:france_connect_information_fake) { create(:france_connect_information, france_connect_particulier_id: 'iugfjh') }
let(:france_connect_information_id) { france_connect_information_fake.id }
it { is_expected.to redirect_to new_user_session_path }
end
context 'when salt and fci_id matches' do
context 'when email is not used' do
context 'when email is valid' do
it { expect { subject }.to change { User.count }.by(1) }
describe 'New user attributs' do
before do
subject
end
let(:user) { User.last }
it { expect(user.email).to eq email }
it { expect(user.france_connect_information).to eq france_connect_information }
end
end
context 'when email is not valid' do
let(:email) { 'kdjizjflk' }
it { expect { subject }.not_to change { User.count } }
it { is_expected.to redirect_to(france_connect_particulier_new_path fci_id: france_connect_information.id, salt: salt, user: {email_france_connect: email}) }
end
end
context 'when email is used' do
let!(:user) { create(:user, email: france_connect_information.email_france_connect) }
let(:email) { france_connect_information.email_france_connect }
let(:password) { user.password }
before do
subject
end
subject { post :check_email, fci_id: france_connect_information_id, salt: salt, user: {email_france_connect: email, password: password} }
context 'when email and password couple is valid' do
it { expect { subject }.not_to change { User.count } }
describe 'Update user attributs' do
before do
subject
end
it { expect(user.france_connect_information).to eq france_connect_information }
end
end
context 'when email and password couple is not valid' do
let(:password) { 'fake' }
it { expect(flash.alert).to eq 'Mot de passe invalide' }
end
end
end
end
describe 'POST #create' do
subject { post :create, user: user_info }
let!(:france_connect_information) { create(:france_connect_information, email_france_connect: email) }
let(:france_connect_information_id) { france_connect_information.id }
let(:salt) { FranceConnectSaltService.new(france_connect_information).salt }
subject { post :create, fci_id: france_connect_information_id, salt: salt, user:{email_france_connect: france_connect_information.email_france_connect} }
context 'when email is filled' do
let(:email) { 'plop@gmail.com' }
@ -93,38 +217,8 @@ describe FranceConnect::ParticulierController, type: :controller do
context 'when email is incorrect' do
let(:email) { '' }
it { expect { subject }.to change { User.count }.by(0) }
it { expect(subject).to redirect_to(france_connect_particulier_new_path(user: user_info)) }
end
end
describe 'POST #check_email' do
let(:email) { 'plop@gmail.com' }
let(:password) { 'blabla141415' }
subject { post :check_email, user: user_info }
context 'when email is linked at an existant user' do
context 'when email and password couple is valid' do
let!(:user) { create(:user, email: email, password: password) }
it { expect { subject }.to change { user.reload.france_connect_particulier_id } }
it { is_expected.to redirect_to root_path }
end
context 'when email and password couple is not valid' do
let!(:user) { create(:user, email: email, password: 'plop12345678') }
before do
subject
end
it { expect(flash[:alert]).to be_present }
end
end
context 'when email is not used' do
it { expect { subject }.to change { User.count }.by(1) }
it { expect { subject }.not_to change { User.count } }
it { expect(subject).to redirect_to(france_connect_particulier_new_path(fci_id: france_connect_information_id, salt: salt, user:{email_france_connect: france_connect_information.email_france_connect})) }
end
end
end

View file

@ -5,9 +5,9 @@ RSpec.describe Users::CarteController, type: :controller do
let(:module_api_carto) { create(:module_api_carto, :with_api_carto) }
let(:procedure) { create(:procedure, module_api_carto: module_api_carto) }
let(:dossier) { create(:dossier, procedure: procedure) }
let(:dossier) { create(:dossier, procedure: procedure) }
let(:dossier_with_no_carto) { create(:dossier, :with_procedure) }
let(:dossier_with_no_carto) { create(:dossier, :with_procedure) }
let!(:entreprise) { create(:entreprise, dossier: dossier) }
let!(:etablissement) { create(:etablissement, dossier: dossier) }
let(:bad_dossier_id) { Dossier.count + 1000 }
@ -18,6 +18,32 @@ RSpec.describe Users::CarteController, type: :controller do
end
describe 'GET #show' do
describe 'before_action authorized_routes?' do
context 'when dossiers procedure have api carto actived' do
context 'when dossier does not have a valid state' do
before do
dossier.state = 'validated'
dossier.save
get :show, dossier_id: dossier.id
end
it { is_expected.to redirect_to root_path}
end
end
context 'when dossiers procedure does not have api carto actived' do
let(:dossier) { create(:dossier, :with_procedure) }
before do
get :show, dossier_id: dossier.id
end
it { is_expected.to redirect_to(root_path) }
end
end
context 'user is not connected' do
before do
sign_out dossier.user
@ -60,7 +86,7 @@ RSpec.describe Users::CarteController, type: :controller do
end
context 'En train de modifier la localisation' do
let(:dossier) { create(:dossier, :with_procedure, state: 'initiated') }
let(:dossier) { create(:dossier, :with_procedure, state: 'initiated') }
before do
post :save, dossier_id: dossier.id, json_latlngs: ''
end
@ -99,7 +125,7 @@ RSpec.describe Users::CarteController, type: :controller do
context 'when json_latlngs params is empty' do
context 'when dossier have quartier prioritaire in database' do
let!(:dossier) { create(:dossier, :with_procedure, :with_two_quartier_prioritaires) }
let!(:dossier) { create(:dossier, :with_procedure, :with_two_quartier_prioritaires) }
before do
dossier.reload
@ -139,14 +165,14 @@ RSpec.describe Users::CarteController, type: :controller do
before do
allow_any_instance_of(CARTO::SGMAP::Cadastre::Adapter).
to receive(:to_params).
and_return([{:surface_intersection=>"0.0006", :surface_parcelle=>11252.692583090324, :numero=>"0013", :feuille=>1, :section=>"CD", :code_dep=>"30", :nom_com=>"Le Grau-du-Roi", :code_com=>"133", :code_arr=>"000", :geometry=>{:type=>"MultiPolygon", :coordinates=>[[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]]}}])
and_return([{:surface_intersection => "0.0006", :surface_parcelle => 11252.692583090324, :numero => "0013", :feuille => 1, :section => "CD", :code_dep => "30", :nom_com => "Le Grau-du-Roi", :code_com => "133", :code_arr => "000", :geometry => {:type => "MultiPolygon", :coordinates => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]]}}])
post :save, dossier_id: dossier.id, json_latlngs: json_latlngs
end
context 'when json_latlngs params is empty' do
context 'when dossier have cadastres in database' do
let!(:dossier) { create(:dossier, :with_procedure, :with_two_cadastres) }
let!(:dossier) { create(:dossier, :with_procedure, :with_two_cadastres) }
before do
dossier.reload
@ -181,7 +207,7 @@ RSpec.describe Users::CarteController, type: :controller do
it { expect(subject.nom_com).to eq('Le Grau-du-Roi') }
it { expect(subject.code_com).to eq('133') }
it { expect(subject.code_arr).to eq('000') }
it { expect(subject.geometry).to eq({"type"=>"MultiPolygon", "coordinates"=>[[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]]}) }
it { expect(subject.geometry).to eq({"type" => "MultiPolygon", "coordinates" => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]]}) }
end
end
end
@ -190,7 +216,7 @@ RSpec.describe Users::CarteController, type: :controller do
describe '#get_position' do
context 'Geocodeur renvoie des positions nil' do
let(:etablissement) { create(:etablissement, adresse: bad_adresse, numero_voie: 'dzj', type_voie: 'fzjfk', nom_voie: 'hdidjkz', complement_adresse: 'fjef', code_postal: 'fjeiefk', localite: 'zjfkfz') }
let(:dossier) { create(:dossier, :with_procedure, etablissement: etablissement) }
let(:dossier) { create(:dossier, :with_procedure, etablissement: etablissement) }
before do
stub_request(:get, /http:\/\/api-adresse[.]data[.]gouv[.]fr\/search[?]limit=1&q=/)
.to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})

View file

@ -33,6 +33,19 @@ describe Users::DescriptionController, type: :controller do
end
it_behaves_like "not owner of dossier", :show
describe 'before_action authorized_routes?' do
context 'when dossier does not have a valid state' do
before do
dossier.state = 'validated'
dossier.save
get :show, dossier_id: dossier.id
end
it { is_expected.to redirect_to root_path }
end
end
end
describe 'POST #create' do

View file

@ -30,7 +30,20 @@ describe Users::DossiersController, type: :controller do
it 'redirection vers liste dossier si mauvais dossier ID' do
get :show, id: siret_not_found
expect(response).to redirect_to('/users/dossiers')
expect(response).to redirect_to root_path
end
describe 'before_action authorized_routes?' do
context 'when dossier does not have a valid state' do
before do
dossier.state = 'validated'
dossier.save
get :show, id: dossier.id
end
it { is_expected.to redirect_to root_path }
end
end
end
@ -152,7 +165,8 @@ describe Users::DossiersController, type: :controller do
end
describe 'Mandataires Sociaux' do
let(:user) { create(:user, given_name: given_name, family_name: family_name, birthdate: birthdate, france_connect_particulier_id: '1234567') }
let(:france_connect_information) { create(:france_connect_information, given_name: given_name, family_name: family_name, birthdate: birthdate, france_connect_particulier_id: '1234567') }
let(:user) { create(:user, france_connect_information: france_connect_information) }
before do
subject

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe Users::RecapitulatifController, type: :controller do
let(:dossier) { create(:dossier, :with_procedure) }
let(:dossier) { create(:dossier, :with_procedure, state:'initiated') }
let(:bad_dossier_id) { Dossier.count + 100000 }
before do
@ -21,6 +21,19 @@ describe Users::RecapitulatifController, type: :controller do
it_behaves_like "not owner of dossier", :show
describe 'before_action authorized_routes?' do
context 'when dossier have draft state' do
before do
dossier.state = 'draft'
dossier.save
get :show, dossier_id: dossier.id
end
it { is_expected.to redirect_to root_path }
end
end
end
describe 'POST #initiate' do

View file

@ -0,0 +1,9 @@
FactoryGirl.define do
factory :france_connect_information do
given_name 'plop'
family_name 'plip'
birthdate '1976-02-24'
france_connect_particulier_id '1234567'
email_france_connect 'plip@octo.com'
end
end

View file

@ -9,8 +9,7 @@ feature 'France Connect Particulier Connexion' do
let(:gender) { 'M' }
let(:birthplace) { '1234' }
let(:email) { 'plop@plop.com' }
let(:know_france_connect_particulier_id) { 'blabla' }
let(:unknow_france_connect_particulier_id) { 'titi' }
let(:france_connect_particulier_id) { 'blabla' }
let(:user_info) { Hashie::Mash.new(france_connect_particulier_id: france_connect_particulier_id,
given_name: given_name,
@ -34,30 +33,31 @@ 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(:france_connect_information) { create(:france_connect_information,
france_connect_particulier_id: france_connect_particulier_id,
given_name: given_name,
family_name: family_name,
birthdate: birthdate,
birthplace: birthplace,
gender: gender,
email_france_connect: email) }
before do
allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_uri).and_return(france_connect_particulier_callback_path(code: code))
allow(FranceConnectService).to receive(:retrieve_user_informations_particulier).and_return(user_info)
page.find_by_id('btn_fcp').click
end
context 'when is the first connexion' do
let(:france_connect_particulier_id) { unknow_france_connect_particulier_id }
before do
page.find_by_id('btn_fcp').click
end
scenario 'he is redirected to france connect particulier page' do
expect(page).to have_content('Nouvelle connexion')
end
context 'when he fill an email and valid' do
before do
page.find_by_id('user_email').set email
page.find_by_id('user_email_france_connect').set email
page.find_by_id('valid_new_fcp').click
end
@ -68,7 +68,10 @@ feature 'France Connect Particulier Connexion' do
end
context 'when is not the first connexion' do
let(:france_connect_particulier_id) { know_france_connect_particulier_id }
before do
create(:user, france_connect_information: france_connect_information)
page.find_by_id('btn_fcp').click
end
scenario 'he is redirected to user dossiers page' do
expect(page).to have_content('Mes dossiers')

View file

@ -38,7 +38,7 @@ feature 'drawing a zone with freedraw' do
end
scenario 'alert message is present' do
expect(page).to have_content('Le dossier n\'a pas accès à la cartographie')
expect(page).to have_content('Le status de votre dossier n\'autorise pas cette URL')
end
end

View file

@ -0,0 +1,41 @@
require 'rails_helper'
describe FranceConnectInformation, type: :model do
describe 'database columns' do
it { is_expected.to have_db_column(:given_name) }
it { is_expected.to have_db_column(:family_name) }
it { is_expected.to have_db_column(:email_france_connect) }
it { is_expected.to have_db_column(:birthdate) }
it { is_expected.to have_db_column(:gender) }
it { is_expected.to have_db_column(:birthplace) }
it { is_expected.to have_db_column(:france_connect_particulier_id) }
end
describe 'associations' do
it { is_expected.to belong_to(:user) }
end
describe 'validation' do
context 'france_connect_particulier_id' do
it { is_expected.not_to allow_value(nil).for(:france_connect_particulier_id) }
it { is_expected.not_to allow_value('').for(:france_connect_particulier_id) }
it { is_expected.to allow_value('mon super projet').for(:france_connect_particulier_id) }
end
end
describe '.find_by_france_connect_particulier' do
let(:user_info) { {france_connect_particulier_id: '123456'} }
subject { described_class.find_by_france_connect_particulier user_info }
context 'when france_connect_particulier_id is prensent in database' do
let!(:france_connect_information) { create(:france_connect_information, france_connect_particulier_id: '123456') }
it { is_expected.to eq france_connect_information }
end
context 'when france_connect_particulier_id is prensent in database' do
it { is_expected.to eq nil }
end
end
end

View file

@ -16,12 +16,6 @@ describe User, type: :model do
it { is_expected.to have_db_column(:updated_at) }
it { is_expected.to have_db_column(:siret) }
it { is_expected.to have_db_column(:loged_in_with_france_connect) }
it { is_expected.to have_db_column(:given_name) }
it { is_expected.to have_db_column(:family_name) }
it { is_expected.to have_db_column(:birthdate) }
it { is_expected.to have_db_column(:gender) }
it { is_expected.to have_db_column(:birthplace) }
it { is_expected.to have_db_column(:france_connect_particulier_id) }
end
describe 'associations' do

View file

@ -0,0 +1,41 @@
require 'spec_helper'
describe FranceConnectSaltService do
describe '.initialize' do
context 'when args is not a FranceConnectInformation class' do
let(:args) { create(:dossier) }
subject { described_class.new args }
it { expect { subject }.to raise_error 'Not a FranceConnectInformation class' }
end
end
describe '.valid?' do
let(:france_connect_information) { create(:france_connect_information) }
let(:salt_service) { FranceConnectSaltService.new(france_connect_information) }
let(:salt) { salt_service.salt }
context 'when france_connect_information_id is correct' do
let(:france_connect_information_id) { france_connect_information.id }
let(:france_connect_information_get_with_id) { FranceConnectInformation.find(france_connect_information_id) }
let(:salt_service_compare) { FranceConnectSaltService.new france_connect_information_get_with_id }
subject { salt_service_compare.valid? salt }
it { is_expected.to be_truthy }
end
context 'when france_connect_information_id is not correct' do
let(:france_connect_information_fake) { create(:france_connect_information, france_connect_particulier_id: '87515272') }
let(:france_connect_information_id) { france_connect_information_fake.id }
let(:france_connect_information_get_with_id) { FranceConnectInformation.find(france_connect_information_id) }
let(:salt_service_compare) { FranceConnectSaltService.new france_connect_information_get_with_id }
subject { salt_service_compare.valid? salt }
it { is_expected.to be_falsey }
end
end
end

View file

@ -0,0 +1,223 @@
require 'spec_helper'
describe UserRoutesAuthorizationService do
describe '#authorize_route?' do
let(:api_carto) { false }
subject { described_class.authorized_route? path, state, api_carto }
context 'when path is not recognized' do
let(:state) { 'blabla' }
let(:path) { 'blabla' }
it { expect { subject }.to raise_error 'Not a valid path' }
end
context 'when state is not recognized' do
let(:state) { 'blabla' }
let(:path) { '' }
it { expect { subject }.to raise_error 'Not a valid state' }
end
context 'when path and state are recognized' do
describe 'root' do
let(:path) { '' }
describe 'draft' do
let(:state) { 'draft' }
it { is_expected.to be_truthy }
end
describe 'initiated' do
let(:state) { 'initiated' }
it { is_expected.to be_falsey }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_falsey }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_falsey }
end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_falsey }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_falsey }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_falsey }
end
end
describe 'carte' do
let(:path) { '/carte' }
context 'when use_api_carto is false' do
describe 'draft' do
let(:state) { 'draft' }
it { is_expected.to be_falsey }
end
describe 'initiated' do
let(:state) { 'initiated' }
it { is_expected.to be_falsey }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_falsey }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_falsey }
end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_falsey }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_falsey }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_falsey }
end
end
context 'when use_api_carto is true' do
let(:api_carto) { true }
describe 'draft' do
let(:state) { 'draft' }
it { is_expected.to be_truthy }
end
describe 'initiated' do
let(:state) { 'initiated' }
it { is_expected.to be_truthy }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_truthy }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_truthy }
end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_falsey }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_falsey }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_falsey }
end
end
end
describe 'description' do
let(:path) { '/description' }
describe 'draft' do
let(:state) { 'draft' }
it { is_expected.to be_truthy }
end
describe 'initiated' do
let(:state) { 'initiated' }
it { is_expected.to be_truthy }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_truthy }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_truthy }
end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_falsey }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_falsey }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_falsey }
end
end
describe 'recapitulatif' do
let(:path) { '/recapitulatif' }
describe 'draft' do
let(:state) { 'draft' }
it { is_expected.to be_falsey }
end
describe 'initiated' do
let(:state) { 'initiated' }
it { is_expected.to be_truthy }
end
describe 'replied' do
let(:state) { 'replied' }
it { is_expected.to be_truthy }
end
describe 'updated' do
let(:state) { 'updated' }
it { is_expected.to be_truthy }
end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_truthy }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_truthy }
end
describe 'closed' do
let(:state) { 'closed' }
it { is_expected.to be_truthy }
end
end
end
end
end