Enable the Layout/SpaceInsideHashLiteralBraces cop

This commit is contained in:
gregoirenovel 2018-01-16 13:34:24 +01:00
parent 02ade68b38
commit b138dcd876
51 changed files with 154 additions and 154 deletions

View file

@ -210,7 +210,7 @@ Layout/SpaceInsideBrackets:
Enabled: true Enabled: true
Layout/SpaceInsideHashLiteralBraces: Layout/SpaceInsideHashLiteralBraces:
Enabled: false Enabled: true
Layout/SpaceInsideArrayLiteralBrackets: Layout/SpaceInsideArrayLiteralBrackets:
Enabled: false Enabled: false

View file

@ -7,7 +7,7 @@ class Admin::TypesDeChampController < AdminController
create_facade create_facade
render 'show', format: :js render 'show', format: :js
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render json: {message: 'Champ not found'}, status: 404 render json: { message: 'Champ not found' }, status: 404
end end
def show def show

View file

@ -7,7 +7,7 @@ class Admin::TypesDeChampPrivateController < AdminController
create_facade create_facade
render 'admin/types_de_champ/show', format: :js render 'admin/types_de_champ/show', format: :js
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render json: {message: 'Champ not found'}, status: 404 render json: { message: 'Champ not found' }, status: 404
end end
def show def show

View file

@ -8,7 +8,7 @@ class API::V1::ProceduresController < APIController
def show def show
procedure = current_administrateur.procedures.find(params[:id]).decorate procedure = current_administrateur.procedures.find(params[:id]).decorate
render json: {procedure: ProcedureSerializer.new(procedure).as_json} render json: { procedure: ProcedureSerializer.new(procedure).as_json }
rescue ActiveRecord::RecordNotFound => e rescue ActiveRecord::RecordNotFound => e
Rails.logger.error(e.message) Rails.logger.error(e.message)
render json: {}, status: 404 render json: {}, status: 404

View file

@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base
end end
def default_url_options def default_url_options
return {protocol: 'https'} if Rails.env.staging? || Rails.env.production? return { protocol: 'https' } if Rails.env.staging? || Rails.env.production?
{} {}
end end

View file

@ -17,6 +17,6 @@ class Ban::SearchController < ApplicationController
lat = point.y.to_s lat = point.y.to_s
end end
render json: {lon: lon, lat: lat, zoom: '14', dossier_id: params[:dossier_id]} render json: { lon: lon, lat: lat, zoom: '14', dossier_id: params[:dossier_id] }
end end
end end

View file

@ -64,7 +64,7 @@ class StatsController < ApplicationController
.count .count
.to_a .to_a
.sort_by { |a| a[0] } .sort_by { |a| a[0] }
.map { |x, y| { x => (sum += y)} } .map { |x, y| { x => (sum += y) } }
.reduce({}, :merge) .reduce({}, :merge)
end end

View file

@ -48,15 +48,15 @@ class Users::CarteController < UsersController
lat = point.y.to_s lat = point.y.to_s
end end
render json: {lon: lon, lat: lat, zoom: zoom, dossier_id: params[:dossier_id]} render json: { lon: lon, lat: lat, zoom: zoom, dossier_id: params[:dossier_id] }
end end
def get_qp def get_qp
render json: {quartier_prioritaires: ModuleApiCartoService.generate_qp(JSON.parse(params[:coordinates]))} render json: { quartier_prioritaires: ModuleApiCartoService.generate_qp(JSON.parse(params[:coordinates])) }
end end
def get_cadastre def get_cadastre
render json: {cadastres: ModuleApiCartoService.generate_cadastre(JSON.parse(params[:coordinates]))} render json: { cadastres: ModuleApiCartoService.generate_cadastre(JSON.parse(params[:coordinates])) }
end end
def self.route_authorization def self.route_authorization

View file

@ -181,7 +181,7 @@ class Users::DossiersController < UsersController
flash.alert = t('errors.messages.invalid_siret') flash.alert = t('errors.messages.invalid_siret')
@facade = facade params[:dossier_id] @facade = facade params[:dossier_id]
render '/dossiers/new_siret', formats: :js, locals: {invalid_siret: siret} render '/dossiers/new_siret', formats: :js, locals: { invalid_siret: siret }
end end
def update_params def update_params

View file

@ -4,12 +4,12 @@ class CARTO::SGMAP::API
def self.search_qp(geojson) def self.search_qp(geojson)
endpoint = "/quartiers-prioritaires/search" endpoint = "/quartiers-prioritaires/search"
call(base_url + endpoint, {geojson: geojson.to_s}) call(base_url + endpoint, { geojson: geojson.to_s })
end end
def self.search_cadastre(geojson) def self.search_cadastre(geojson)
endpoint = "/cadastre/geometrie" endpoint = "/cadastre/geometrie"
call(base_url + endpoint, {geojson: geojson.to_s}) call(base_url + endpoint, { geojson: geojson.to_s })
end end
private private

View file

@ -3,7 +3,7 @@ class Cerfa < ActiveRecord::Base
belongs_to :user belongs_to :user
mount_uploader :content, CerfaUploader mount_uploader :content, CerfaUploader
validates :content, :file_size => {:maximum => 20.megabytes} validates :content, :file_size => { :maximum => 20.megabytes }
after_save :internal_notification, if: Proc.new { dossier.present? } after_save :internal_notification, if: Proc.new { dossier.present? }

View file

@ -177,7 +177,7 @@ class Gestionnaire < ActiveRecord::Base
} }
] ]
couples.include?({table: table, column: column}) couples.include?({ table: table, column: column })
end end
def annotations_hash(demande, annotations_privees, avis, messagerie) def annotations_hash(demande, annotations_privees, avis, messagerie)

View file

@ -10,7 +10,7 @@ class PieceJustificative < ActiveRecord::Base
alias_attribute :type, :type_de_piece_justificative_id alias_attribute :type, :type_de_piece_justificative_id
mount_uploader :content, PieceJustificativeUploader mount_uploader :content, PieceJustificativeUploader
validates :content, :file_size => {:maximum => 20.megabytes} validates :content, :file_size => { :maximum => 20.megabytes }
validates :content, presence: true, allow_blank: false, allow_nil: false validates :content, presence: true, allow_blank: false, allow_nil: false
after_save :internal_notification, if: Proc.new { dossier.present? } after_save :internal_notification, if: Proc.new { dossier.present? }

View file

@ -17,7 +17,7 @@ Rails.application.routes.draw do
root to: "administrateurs#index" root to: "administrateurs#index"
end end
get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/} get "/ping" => "ping#index", :constraints => { :ip => /127.0.0.1/ }
devise_for :administrations, devise_for :administrations,
skip: [:password, :registrations, :sessions], skip: [:password, :registrations, :sessions],

View file

@ -43,7 +43,7 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
} }
] ]
couples.include?({table: table, column: column}) couples.include?({ table: table, column: column })
end end
end end

View file

@ -141,7 +141,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
} }
] ]
couples.include?({table: table, column: column}) couples.include?({ table: table, column: column })
end end
end end

View file

@ -10,12 +10,12 @@ describe Admin::AccompagnateursController, type: :controller do
end end
describe 'GET #show' do describe 'GET #show' do
subject { get :show, params: {procedure_id: procedure.id} } subject { get :show, params: { procedure_id: procedure.id } }
it { expect(subject.status).to eq(200) } it { expect(subject.status).to eq(200) }
end end
describe 'PUT #update' do describe 'PUT #update' do
subject { put :update, params: {accompagnateur_id: gestionnaire.id, procedure_id: procedure.id, to: 'assign'} } subject { put :update, params: { accompagnateur_id: gestionnaire.id, procedure_id: procedure.id, to: 'assign' } }
it { expect(subject).to redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure.id) } it { expect(subject).to redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure.id) }

View file

@ -17,7 +17,7 @@ describe Admin::GestionnairesController, type: :controller do
describe 'POST #create' do describe 'POST #create' do
let(:email) { 'test@plop.com' } let(:email) { 'test@plop.com' }
let(:procedure_id) { nil } let(:procedure_id) { nil }
subject { post :create, params: {gestionnaire: {email: email}, procedure_id: procedure_id} } subject { post :create, params: { gestionnaire: { email: email }, procedure_id: procedure_id } }
context 'When email is valid' do context 'When email is valid' do
before do before do
@ -169,7 +169,7 @@ describe Admin::GestionnairesController, type: :controller do
let!(:admin) { create :administrateur } let!(:admin) { create :administrateur }
let!(:gestionnaire) { create :gestionnaire, email: email, administrateurs: [admin] } let!(:gestionnaire) { create :gestionnaire, email: email, administrateurs: [admin] }
subject { delete :destroy, params: {id: gestionnaire.id} } subject { delete :destroy, params: { id: gestionnaire.id } }
context "when gestionaire_id is valid" do context "when gestionaire_id is valid" do
before do before do

View file

@ -11,7 +11,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
describe 'GET #show' do describe 'GET #show' do
let(:procedure_id) { procedure.id } let(:procedure_id) { procedure.id }
subject { get :show, params: {procedure_id: procedure_id} } subject { get :show, params: { procedure_id: procedure_id } }
context 'when procedure is not found' do context 'when procedure is not found' do
let(:procedure_id) { 9_999_999 } let(:procedure_id) { 9_999_999 }
@ -47,7 +47,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
} }
end end
let(:request) { put :update, params: {procedure_id: procedure_id, format: :js, procedure: update_params} } let(:request) { put :update, params: { procedure_id: procedure_id, format: :js, procedure: update_params } }
subject { request } subject { request }
it { is_expected.to render_template('show') } it { is_expected.to render_template('show') }
@ -75,7 +75,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
let!(:pj) { create(:type_de_piece_justificative, procedure: procedure) } let!(:pj) { create(:type_de_piece_justificative, procedure: procedure) }
let(:procedure_id) { procedure.id } let(:procedure_id) { procedure.id }
let(:pj_id) { pj.id } let(:pj_id) { pj.id }
let(:request) { delete :destroy, params: {procedure_id: procedure_id, id: pj_id} } let(:request) { delete :destroy, params: { procedure_id: procedure_id, id: pj_id } }
subject { request } subject { request }
context 'when procedure is not found' do context 'when procedure is not found' do
let(:procedure_id) { 9_999_999 } let(:procedure_id) { 9_999_999 }
@ -98,7 +98,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
end end
describe 'POST #move_up' do describe 'POST #move_up' do
subject { post :move_up, params: {procedure_id: procedure.id, index: index, format: :js} } subject { post :move_up, params: { procedure_id: procedure.id, index: index, format: :js } }
context 'when procedure have no type de champ' do context 'when procedure have no type de champ' do
let(:index) { 0 } let(:index) { 0 }
@ -124,7 +124,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
it { expect(subject.status).to eq(200) } it { expect(subject.status).to eq(200) }
it { expect(subject).to render_template('show') } it { expect(subject).to render_template('show') }
it 'changes order places' do it 'changes order places' do
post :move_up, params: {procedure_id: procedure.id, index: index, format: :js} post :move_up, params: { procedure_id: procedure.id, index: index, format: :js }
type_de_piece_justificative_0.reload type_de_piece_justificative_0.reload
type_de_piece_justificative_1.reload type_de_piece_justificative_1.reload
expect(type_de_piece_justificative_0.order_place).to eq(1) expect(type_de_piece_justificative_0.order_place).to eq(1)
@ -135,7 +135,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
end end
describe 'POST #move_down' do describe 'POST #move_down' do
let(:request) { post :move_down, params: {procedure_id: procedure.id, index: index, format: :js} } let(:request) { post :move_down, params: { procedure_id: procedure.id, index: index, format: :js } }
let(:index) { 0 } let(:index) { 0 }
subject { request } subject { request }

View file

@ -9,7 +9,7 @@ describe Admin::PrevisualisationsController, type: :controller do
end end
describe 'GET #show' do describe 'GET #show' do
subject { get :show, params: {procedure_id: procedure.id} } subject { get :show, params: { procedure_id: procedure.id } }
it { expect(subject.status).to eq(200) } it { expect(subject.status).to eq(200) }
end end
end end

View file

@ -59,7 +59,7 @@ describe Admin::ProceduresController, type: :controller do
let(:procedure_published) { create :procedure, administrateur: admin, published_at: Time.now, archived_at: nil } let(:procedure_published) { create :procedure, administrateur: admin, published_at: Time.now, archived_at: nil }
let(:procedure_archived) { create :procedure, administrateur: admin, published_at: nil, archived_at: Time.now } let(:procedure_archived) { create :procedure, administrateur: admin, published_at: nil, archived_at: Time.now }
subject { delete :destroy, params: {id: procedure.id} } subject { delete :destroy, params: { id: procedure.id } }
context 'when procedure is draft' do context 'when procedure is draft' do
let!(:procedure) { procedure_draft } let!(:procedure) { procedure_draft }
@ -96,7 +96,7 @@ describe Admin::ProceduresController, type: :controller do
context "when administrateur does not own the procedure" do context "when administrateur does not own the procedure" do
let(:procedure_not_owned) { create :procedure, administrateur: create(:administrateur), published_at: nil, archived_at: nil } let(:procedure_not_owned) { create :procedure, administrateur: create(:administrateur), published_at: nil, archived_at: nil }
subject { delete :destroy, params: {id: procedure_not_owned.id} } subject { delete :destroy, params: { id: procedure_not_owned.id } }
it { expect{ subject }.to raise_error(ActiveRecord::RecordNotFound) } it { expect{ subject }.to raise_error(ActiveRecord::RecordNotFound) }
end end
@ -107,7 +107,7 @@ describe Admin::ProceduresController, type: :controller do
let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) } let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) }
let(:procedure_id) { procedure.id } let(:procedure_id) { procedure.id }
subject { get :edit, params: {id: procedure_id} } subject { get :edit, params: { id: procedure_id } }
context 'when user is not connected' do context 'when user is not connected' do
before do before do
@ -139,14 +139,14 @@ describe Admin::ProceduresController, type: :controller do
describe 'POST #create' do describe 'POST #create' do
context 'when all attributs are filled' do context 'when all attributs are filled' do
describe 'new procedure in database' do describe 'new procedure in database' do
subject { post :create, params: {procedure: procedure_params} } subject { post :create, params: { procedure: procedure_params } }
it { expect { subject }.to change { Procedure.count }.by(1) } it { expect { subject }.to change { Procedure.count }.by(1) }
end end
context 'when procedure is correctly save' do context 'when procedure is correctly save' do
before do before do
post :create, params: {procedure: procedure_params} post :create, params: { procedure: procedure_params }
end end
describe 'procedure attributs in database' do describe 'procedure attributs in database' do
@ -183,7 +183,7 @@ describe Admin::ProceduresController, type: :controller do
let(:description) { '' } let(:description) { '' }
describe 'no new procedure in database' do describe 'no new procedure in database' do
subject { post :create, params: {procedure: procedure_params} } subject { post :create, params: { procedure: procedure_params } }
it { expect { subject }.to change { Procedure.count }.by(0) } it { expect { subject }.to change { Procedure.count }.by(0) }
@ -194,7 +194,7 @@ describe Admin::ProceduresController, type: :controller do
describe 'flash message is present' do describe 'flash message is present' do
before do before do
post :create, params: {procedure: procedure_params} post :create, params: { procedure: procedure_params }
end end
it { expect(flash[:alert]).to be_present } it { expect(flash[:alert]).to be_present }
@ -210,14 +210,14 @@ describe Admin::ProceduresController, type: :controller do
sign_out admin sign_out admin
end end
subject { put :update, params: {id: procedure.id} } subject { put :update, params: { id: procedure.id } }
it { is_expected.to redirect_to new_user_session_path } it { is_expected.to redirect_to new_user_session_path }
end end
context 'when administrateur is connected' do context 'when administrateur is connected' do
before do before do
put :update, params: {id: procedure.id, procedure: procedure_params} put :update, params: { id: procedure.id, procedure: procedure_params }
procedure.reload procedure.reload
end end
@ -297,7 +297,7 @@ describe Admin::ProceduresController, type: :controller do
context 'when admin is the owner of the procedure' do context 'when admin is the owner of the procedure' do
before do before do
put :publish, params: {procedure_id: procedure.id, procedure_path: procedure_path} put :publish, params: { procedure_id: procedure.id, procedure_path: procedure_path }
procedure.reload procedure.reload
procedure2.reload procedure2.reload
end end
@ -364,7 +364,7 @@ describe Admin::ProceduresController, type: :controller do
sign_out admin sign_out admin
sign_in admin_2 sign_in admin_2
put :publish, params: {procedure_id: procedure.id, procedure_path: 'fake_path'} put :publish, params: { procedure_id: procedure.id, procedure_path: 'fake_path' }
procedure.reload procedure.reload
end end
@ -380,7 +380,7 @@ describe Admin::ProceduresController, type: :controller do
context 'when admin is the owner of the procedure' do context 'when admin is the owner of the procedure' do
before do before do
put :archive, params: {procedure_id: procedure.id} put :archive, params: { procedure_id: procedure.id }
procedure.reload procedure.reload
end end
@ -392,7 +392,7 @@ describe Admin::ProceduresController, type: :controller do
context 'when owner want to re-enable procedure' do context 'when owner want to re-enable procedure' do
before do before do
put :publish, params: {procedure_id: procedure.id, procedure_path: 'fake_path'} put :publish, params: { procedure_id: procedure.id, procedure_path: 'fake_path' }
procedure.reload procedure.reload
end end
@ -409,7 +409,7 @@ describe Admin::ProceduresController, type: :controller do
sign_out admin sign_out admin
sign_in admin_2 sign_in admin_2
put :archive, params: {procedure_id: procedure.id} put :archive, params: { procedure_id: procedure.id }
procedure.reload procedure.reload
end end
@ -420,7 +420,7 @@ describe Admin::ProceduresController, type: :controller do
describe 'PUT #clone' do describe 'PUT #clone' do
let!(:procedure) { create(:procedure, administrateur: admin) } let!(:procedure) { create(:procedure, administrateur: admin) }
subject { put :clone, params: {procedure_id: procedure.id} } subject { put :clone, params: { procedure_id: procedure.id } }
it { expect { subject }.to change(Procedure, :count).by(1) } it { expect { subject }.to change(Procedure, :count).by(1) }
@ -502,7 +502,7 @@ describe Admin::ProceduresController, type: :controller do
describe 'POST transfer' do describe 'POST transfer' do
let!(:procedure) { create :procedure, administrateur: admin } let!(:procedure) { create :procedure, administrateur: admin }
subject { post :transfer, params: {email_admin: email_admin, procedure_id: procedure.id} } subject { post :transfer, params: { email_admin: email_admin, procedure_id: procedure.id } }
context 'when admin is unknow' do context 'when admin is unknow' do
let(:email_admin) { 'plop' } let(:email_admin) { 'plop' }

View file

@ -13,7 +13,7 @@ describe Admin::TypesDeChampController, type: :controller do
let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) } let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) }
let(:procedure_id) { procedure.id } let(:procedure_id) { procedure.id }
subject { get :show, params: {procedure_id: procedure_id} } subject { get :show, params: { procedure_id: procedure_id } }
context 'when procedure is not found' do context 'when procedure is not found' do
let(:procedure_id) { 9_999_999 } let(:procedure_id) { 9_999_999 }
@ -64,7 +64,7 @@ describe Admin::TypesDeChampController, type: :controller do
} }
end end
let(:request) { put :update, params: {procedure_id: procedure.id, procedure: procedure_params}, format: :js } let(:request) { put :update, params: { procedure_id: procedure.id, procedure: procedure_params }, format: :js }
context 'when procedure is found' do context 'when procedure is found' do
it { expect { request }.to change(TypeDeChamp, :count).by(1) } it { expect { request }.to change(TypeDeChamp, :count).by(1) }
@ -122,7 +122,7 @@ describe Admin::TypesDeChampController, type: :controller do
end end
end end
context 'when procedure is not found' do context 'when procedure is not found' do
subject { put :update, format: :js, params: {procedure_id: 9_999_999, procedure: procedure_params} } subject { put :update, format: :js, params: { procedure_id: 9_999_999, procedure: procedure_params } }
it 'creates type de champ' do it 'creates type de champ' do
expect(subject.status).to eq(404) expect(subject.status).to eq(404)
end end
@ -131,7 +131,7 @@ describe Admin::TypesDeChampController, type: :controller do
describe '#destroy' do describe '#destroy' do
before do before do
delete :destroy, params: {procedure_id: procedure.id, id: type_de_champ_id, format: :js} delete :destroy, params: { procedure_id: procedure.id, id: type_de_champ_id, format: :js }
end end
context 'when type de champs does not exist' do context 'when type de champs does not exist' do
@ -155,7 +155,7 @@ describe Admin::TypesDeChampController, type: :controller do
end end
describe 'POST #move_up' do describe 'POST #move_up' do
subject { post :move_up, params: {procedure_id: procedure.id, index: index, format: :js} } subject { post :move_up, params: { procedure_id: procedure.id, index: index, format: :js } }
context 'when procedure have no type de champ' do context 'when procedure have no type de champ' do
let(:index) { 0 } let(:index) { 0 }
@ -181,7 +181,7 @@ describe Admin::TypesDeChampController, type: :controller do
it { expect(subject.status).to eq(200) } it { expect(subject.status).to eq(200) }
it { expect(subject).to render_template('show') } it { expect(subject).to render_template('show') }
it 'changes order places' do it 'changes order places' do
post :move_up, params: {procedure_id: procedure.id, index: index, format: :js} post :move_up, params: { procedure_id: procedure.id, index: index, format: :js }
type_de_champ_0.reload type_de_champ_0.reload
type_de_champ_1.reload type_de_champ_1.reload
expect(type_de_champ_0.order_place).to eq(1) expect(type_de_champ_0.order_place).to eq(1)
@ -192,7 +192,7 @@ describe Admin::TypesDeChampController, type: :controller do
end end
describe 'POST #move_down' do describe 'POST #move_down' do
let(:request) { post :move_down, params: {procedure_id: procedure.id, index: index, format: :js} } let(:request) { post :move_down, params: { procedure_id: procedure.id, index: index, format: :js } }
let(:index) { 0 } let(:index) { 0 }
subject { request } subject { request }

View file

@ -13,7 +13,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) } let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) }
let(:procedure_id) { procedure.id } let(:procedure_id) { procedure.id }
subject { get :show, params: {procedure_id: procedure_id} } subject { get :show, params: { procedure_id: procedure_id } }
context 'when procedure is not found' do context 'when procedure is not found' do
let(:procedure_id) { 9_999_999 } let(:procedure_id) { 9_999_999 }
@ -65,7 +65,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
} }
end end
let(:request) { put :update, params: {format: :js, procedure_id: procedure.id, procedure: procedure_params} } let(:request) { put :update, params: { format: :js, procedure_id: procedure.id, procedure: procedure_params } }
context 'when procedure is found' do context 'when procedure is found' do
it { expect { request }.to change(TypeDeChamp, :count).by(1) } it { expect { request }.to change(TypeDeChamp, :count).by(1) }
@ -105,7 +105,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
end end
end end
context 'when procedure is not found' do context 'when procedure is not found' do
subject { put :update, params: {format: :js, procedure_id: 9_999_999, procedure: procedure_params} } subject { put :update, params: { format: :js, procedure_id: 9_999_999, procedure: procedure_params } }
it 'creates type de champ' do it 'creates type de champ' do
expect(subject.status).to eq(404) expect(subject.status).to eq(404)
end end
@ -114,7 +114,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
describe '#destroy' do describe '#destroy' do
before do before do
delete :destroy, params: {procedure_id: procedure.id, id: type_de_champ_id, format: :js} delete :destroy, params: { procedure_id: procedure.id, id: type_de_champ_id, format: :js }
end end
context 'when type de champs does not exist' do context 'when type de champs does not exist' do
@ -138,7 +138,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
end end
describe 'POST #move_up' do describe 'POST #move_up' do
subject { post :move_up, params: {procedure_id: procedure.id, index: index, format: :js} } subject { post :move_up, params: { procedure_id: procedure.id, index: index, format: :js } }
context 'when procedure have no type de champ' do context 'when procedure have no type de champ' do
let(:index) { 0 } let(:index) { 0 }
@ -164,7 +164,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
it { expect(subject.status).to eq(200) } it { expect(subject.status).to eq(200) }
it { expect(subject).to render_template('show') } it { expect(subject).to render_template('show') }
it 'changes order places' do it 'changes order places' do
post :move_up, params: {procedure_id: procedure.id, index: index, format: :js} post :move_up, params: { procedure_id: procedure.id, index: index, format: :js }
type_de_champ_0.reload type_de_champ_0.reload
type_de_champ_1.reload type_de_champ_1.reload
expect(type_de_champ_0.order_place).to eq(1) expect(type_de_champ_0.order_place).to eq(1)
@ -175,7 +175,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
end end
describe 'POST #move_down' do describe 'POST #move_down' do
let(:request) { post :move_down, params: {procedure_id: procedure.id, index: index, format: :js} } let(:request) { post :move_down, params: { procedure_id: procedure.id, index: index, format: :js } }
let(:index) { 0 } let(:index) { 0 }
subject { request } subject { request }

View file

@ -8,7 +8,7 @@ describe API::V1::DossiersController do
it { expect(described_class).to be < APIController } it { expect(described_class).to be < APIController }
describe 'GET index' do describe 'GET index' do
let(:retour) { get :index, params: {token: admin.api_token, procedure_id: procedure_id} } let(:retour) { get :index, params: { token: admin.api_token, procedure_id: procedure_id } }
subject { retour } subject { retour }
@ -59,7 +59,7 @@ describe API::V1::DossiersController do
end end
context 'when there are multiple pages' do context 'when there are multiple pages' do
let(:retour) { get :index, params: {token: admin.api_token, procedure_id: procedure_id, page: 2} } let(:retour) { get :index, params: { token: admin.api_token, procedure_id: procedure_id, page: 2 } }
let!(:dossier1) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') } let!(:dossier1) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') } let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
@ -80,7 +80,7 @@ describe API::V1::DossiersController do
end end
describe 'GET show' do describe 'GET show' do
let(:retour) { get :show, params: {token: admin.api_token, procedure_id: procedure_id, id: dossier_id} } let(:retour) { get :show, params: { token: admin.api_token, procedure_id: procedure_id, id: dossier_id } }
subject { retour } subject { retour }
context 'when procedure is not found' do context 'when procedure is not found' do
@ -178,7 +178,7 @@ describe API::V1::DossiersController do
end end
end end
describe 'piece justificative', vcr: {cassette_name: 'controllers_api_v1_dossiers_controller_piece_justificative'} do describe 'piece justificative', vcr: { cassette_name: 'controllers_api_v1_dossiers_controller_piece_justificative' } do
before do before do
create :piece_justificative, :rib, dossier: dossier, type_de_piece_justificative: dossier.procedure.types_de_piece_justificative.first, user: dossier.user create :piece_justificative, :rib, dossier: dossier, type_de_piece_justificative: dossier.procedure.types_de_piece_justificative.first, user: dossier.user
end end
@ -240,7 +240,7 @@ describe API::V1::DossiersController do
super().find { |champ| champ[:type_de_champ][:type_champ] == 'quartier_prioritaire' } super().find { |champ| champ[:type_de_champ][:type_champ] == 'quartier_prioritaire' }
end end
it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'quartier prioritaire', type_champ: 'quartier_prioritaire', order_place: -1, descripton: ''}) } it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'quartier prioritaire', type_champ: 'quartier_prioritaire', order_place: -1, descripton: '' }) }
it { expect(subject[:value]).to match(dossier.quartier_prioritaires.first.geometry.symbolize_keys) } it { expect(subject[:value]).to match(dossier.quartier_prioritaires.first.geometry.symbolize_keys) }
end end
@ -253,7 +253,7 @@ describe API::V1::DossiersController do
super().find { |champ| champ[:type_de_champ][:type_champ] == 'cadastre' } super().find { |champ| champ[:type_de_champ][:type_champ] == 'cadastre' }
end end
it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'cadastre', type_champ: 'cadastre', order_place: -1, descripton: ''}) } it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'cadastre', type_champ: 'cadastre', order_place: -1, descripton: '' }) }
it { expect(subject[:value]).to match(dossier.cadastres.first.geometry.symbolize_keys) } it { expect(subject[:value]).to match(dossier.cadastres.first.geometry.symbolize_keys) }
end end
@ -267,7 +267,7 @@ describe API::V1::DossiersController do
super().find { |champ| champ[:type_de_champ][:type_champ] == 'user_geometry' } super().find { |champ| champ[:type_de_champ][:type_champ] == 'user_geometry' }
end end
it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'user_geometry', type_champ: 'user_geometry', order_place: -1, descripton: ''}) } it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'user_geometry', type_champ: 'user_geometry', order_place: -1, descripton: '' }) }
it { expect(subject[:value]).to match(UserGeometry.new(dossier.json_latlngs).value) } it { expect(subject[:value]).to match(UserGeometry.new(dossier.json_latlngs).value) }
end end
end end
@ -318,7 +318,7 @@ describe API::V1::DossiersController do
it { expect(subject.first[:email]).to eq 'plop@plip.com' } it { expect(subject.first[:email]).to eq 'plop@plip.com' }
end end
describe 'cerfa', vcr: {cassette_name: 'controllers_api_v1_dossiers_controller_cerfa'} do describe 'cerfa', vcr: { cassette_name: 'controllers_api_v1_dossiers_controller_cerfa' } do
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, :with_cerfa_upload, procedure: procedure) } } let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, :with_cerfa_upload, procedure: procedure) } }
let(:content) { File.open('./spec/support/files/piece_justificative_388.pdf') } let(:content) { File.open('./spec/support/files/piece_justificative_388.pdf') }

View file

@ -18,12 +18,12 @@ describe APIController, type: :controller do
end end
context 'when token does not exist' do context 'when token does not exist' do
let(:token) { 'invalid_token' } let(:token) { 'invalid_token' }
subject { get :index, params: {token: token} } subject { get :index, params: { token: token } }
it { expect(subject.status).to eq(401) } it { expect(subject.status).to eq(401) }
end end
context 'when token exist' do context 'when token exist' do
let(:administrateur) { create(:administrateur) } let(:administrateur) { create(:administrateur) }
subject { get :index, params: {token: administrateur.api_token} } subject { get :index, params: { token: administrateur.api_token } }
it { expect(subject.status).to eq(200) } it { expect(subject.status).to eq(200) }
end end
end end

View file

@ -2,20 +2,20 @@ require 'spec_helper'
describe Ban::SearchController, type: :controller do describe Ban::SearchController, type: :controller do
describe '#GET get' do describe '#GET get' do
subject { get :get, params: {request: request} } subject { get :get, params: { request: request } }
before do before do
subject subject
end end
context 'when request return result', vcr: {cassette_name: 'bano_search_paris'} do context 'when request return result', vcr: { cassette_name: 'bano_search_paris' } do
let (:request) { 'Paris' } let (:request) { 'Paris' }
it { expect(response.status).to eq 200 } it { expect(response.status).to eq 200 }
it { expect(response.body).to eq '[{"label":"Paris"},{"label":"Paris 63120 Courpière"},{"label":"PARIS (Vaillac) 46240 Cœur de Causse"},{"label":"Paris 40500 Saint-Sever"},{"label":"Paris Buton 37140 Bourgueil"}]' } it { expect(response.body).to eq '[{"label":"Paris"},{"label":"Paris 63120 Courpière"},{"label":"PARIS (Vaillac) 46240 Cœur de Causse"},{"label":"Paris 40500 Saint-Sever"},{"label":"Paris Buton 37140 Bourgueil"}]' }
end end
context 'when request return nothing', vcr: {cassette_name: 'bano_search_nothing'} do context 'when request return nothing', vcr: { cassette_name: 'bano_search_nothing' } do
let (:request) { 'je recherche pas grand chose' } let (:request) { 'je recherche pas grand chose' }
it { expect(response.status).to eq 200 } it { expect(response.status).to eq 200 }
@ -25,22 +25,22 @@ describe Ban::SearchController, type: :controller do
describe '#GET get_address_point' do describe '#GET get_address_point' do
let(:dossier_id) { "1" } let(:dossier_id) { "1" }
subject { get :get_address_point, params: {request: request, dossier_id: dossier_id} } subject { get :get_address_point, params: { request: request, dossier_id: dossier_id } }
before do before do
subject subject
end end
context 'when request return result', vcr: {cassette_name: 'ban_search_paris'} do context 'when request return result', vcr: { cassette_name: 'ban_search_paris' } do
let(:request) { 'Paris' } let(:request) { 'Paris' }
it { expect(response.body).to eq ({lon: '2.3469', lat: '48.8589', zoom: '14', dossier_id: dossier_id}).to_json } it { expect(response.body).to eq ({ lon: '2.3469', lat: '48.8589', zoom: '14', dossier_id: dossier_id }).to_json }
end end
context 'when request return nothing', vcr: {cassette_name: 'ban_search_nothing'} do context 'when request return nothing', vcr: { cassette_name: 'ban_search_nothing' } do
let(:request) { 'je recherche pas grand chose' } let(:request) { 'je recherche pas grand chose' }
it { expect(response.body).to eq ({lon: nil, lat: nil, zoom: '14', dossier_id: dossier_id}).to_json } it { expect(response.body).to eq ({ lon: nil, lat: nil, zoom: '14', dossier_id: dossier_id }).to_json }
end end
end end
end end

View file

@ -23,7 +23,7 @@ describe FranceConnect::ParticulierController, type: :controller do
describe '#callback' do describe '#callback' do
let(:code) { 'plop' } let(:code) { 'plop' }
subject { get :callback, params: {code: code} } subject { get :callback, params: { code: code } }
context 'when param code is missing' do context 'when param code is missing' do
let(:code) { nil } let(:code) { nil }

View file

@ -11,7 +11,7 @@ describe InvitesController, type: :controller do
sign_in signed_in_profile sign_in signed_in_profile
end end
subject { post :create, params: {dossier_id: dossier.id, email: email} } subject { post :create, params: { dossier_id: dossier.id, email: email } }
context "when gestionnaire is signed_in" do context "when gestionnaire is signed_in" do
let(:signed_in_profile) { create(:gestionnaire) } let(:signed_in_profile) { create(:gestionnaire) }

View file

@ -95,7 +95,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
sign_in gestionnaire sign_in gestionnaire
end end
subject { post :repasser_en_construction, params: { procedure_id: procedure.id, dossier_id: dossier.id} } subject { post :repasser_en_construction, params: { procedure_id: procedure.id, dossier_id: dossier.id } }
it 'change state to en_construction' do it 'change state to en_construction' do
subject subject
@ -114,7 +114,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
sign_in gestionnaire sign_in gestionnaire
end end
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id} } subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id } }
it 'change state to refuse' do it 'change state to refuse' do
subject subject
@ -140,7 +140,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
sign_in gestionnaire sign_in gestionnaire
end end
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id} } subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id } }
it 'change state to sans_suite' do it 'change state to sans_suite' do
subject subject
@ -174,7 +174,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
expect(NotificationMailer).to receive(:deliver_now!) expect(NotificationMailer).to receive(:deliver_now!)
end end
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id} } subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id } }
it 'change state to accepte' do it 'change state to accepte' do
subject subject

View file

@ -7,7 +7,7 @@ shared_examples 'carte_controller_spec' do
dossier.state = 'en_instruction' dossier.state = 'en_instruction'
dossier.save dossier.save
get :show, params: {dossier_id: dossier.id} get :show, params: { dossier_id: dossier.id }
end end
it { is_expected.to redirect_to root_path } it { is_expected.to redirect_to root_path }
@ -18,7 +18,7 @@ shared_examples 'carte_controller_spec' do
let(:dossier) { create(:dossier) } let(:dossier) { create(:dossier) }
before do before do
get :show, params: {dossier_id: dossier.id} get :show, params: { dossier_id: dossier.id }
end end
it { is_expected.to redirect_to(root_path) } it { is_expected.to redirect_to(root_path) }
@ -31,26 +31,26 @@ shared_examples 'carte_controller_spec' do
end end
it 'redirects to users/sign_in' do it 'redirects to users/sign_in' do
get :show, params: {dossier_id: dossier.id} get :show, params: { dossier_id: dossier.id }
expect(response).to redirect_to('/users/sign_in') expect(response).to redirect_to('/users/sign_in')
end end
end end
it 'returns http success if carto is activated' do it 'returns http success if carto is activated' do
get :show, params: {dossier_id: dossier.id} get :show, params: { dossier_id: dossier.id }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
context 'when procedure not have activate api carto' do context 'when procedure not have activate api carto' do
it 'redirection on user dossier list' do it 'redirection on user dossier list' do
get :show, params: {dossier_id: dossier_with_no_carto.id} get :show, params: { dossier_id: dossier_with_no_carto.id }
expect(response).to redirect_to(root_path) expect(response).to redirect_to(root_path)
end end
end end
context 'when dossier id not exist' do context 'when dossier id not exist' do
it 'redirection on user dossier list' do it 'redirection on user dossier list' do
get :show, params: {dossier_id: bad_dossier_id} get :show, params: { dossier_id: bad_dossier_id }
expect(response).to redirect_to(root_path) expect(response).to redirect_to(root_path)
end end
end end
@ -61,7 +61,7 @@ shared_examples 'carte_controller_spec' do
describe 'POST #save' do describe 'POST #save' do
context 'Aucune localisation n\'a jamais été enregistrée' do context 'Aucune localisation n\'a jamais été enregistrée' do
it do it do
post :save, params: {dossier_id: dossier.id, json_latlngs: ''} post :save, params: { dossier_id: dossier.id, json_latlngs: '' }
expect(response).to redirect_to("/users/dossiers/#{dossier.id}/description") expect(response).to redirect_to("/users/dossiers/#{dossier.id}/description")
end end
end end
@ -69,7 +69,7 @@ shared_examples 'carte_controller_spec' do
context 'En train de modifier la localisation' do context 'En train de modifier la localisation' do
let(:dossier) { create(:dossier, state: 'en_construction') } let(:dossier) { create(:dossier, state: 'en_construction') }
before do before do
post :save, params: {dossier_id: dossier.id, json_latlngs: ''} post :save, params: { dossier_id: dossier.id, json_latlngs: '' }
end end
it 'Redirection vers la page récapitulatif' do it 'Redirection vers la page récapitulatif' do
@ -83,9 +83,9 @@ shared_examples 'carte_controller_spec' do
before do before do
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter) allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
.to receive(:to_params) .to receive(:to_params)
.and_return({"QPCODE1234" => {:code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => {:type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]]}}}) .and_return({ "QPCODE1234" => { :code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } } })
post :save, params: {dossier_id: dossier.id, json_latlngs: json_latlngs} post :save, params: { dossier_id: dossier.id, json_latlngs: json_latlngs }
end end
context 'when json_latlngs params is empty' do context 'when json_latlngs params is empty' do
@ -130,9 +130,9 @@ shared_examples 'carte_controller_spec' do
before do before do
allow_any_instance_of(CARTO::SGMAP::Cadastre::Adapter) allow_any_instance_of(CARTO::SGMAP::Cadastre::Adapter)
.to receive(:to_params) .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, params: {dossier_id: dossier.id, json_latlngs: json_latlngs} post :save, params: { dossier_id: dossier.id, json_latlngs: json_latlngs }
end end
context 'when json_latlngs params is empty' do context 'when json_latlngs params is empty' do
@ -172,7 +172,7 @@ shared_examples 'carte_controller_spec' do
it { expect(subject.nom_com).to eq('Le Grau-du-Roi') } it { expect(subject.nom_com).to eq('Le Grau-du-Roi') }
it { expect(subject.code_com).to eq('133') } it { expect(subject.code_com).to eq('133') }
it { expect(subject.code_arr).to eq('000') } 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 end
end end
@ -185,7 +185,7 @@ shared_examples 'carte_controller_spec' do
stub_request(:get, /http:\/\/api-adresse[.]data[.]gouv[.]fr\/search[?]limit=1&q=/) 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: {}) .to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
get :get_position, params: {dossier_id: dossier.id} get :get_position, params: { dossier_id: dossier.id }
end end
subject { JSON.parse(response.body) } subject { JSON.parse(response.body) }
@ -203,7 +203,7 @@ shared_examples 'carte_controller_spec' do
before do before do
stub_request(:get, /http:\/\/api-adresse[.]data[.]gouv[.]fr\/search[?]limit=1&q=/) 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: {}) .to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
get :get_position, params: {dossier_id: dossier.id} get :get_position, params: { dossier_id: dossier.id }
end end
subject { JSON.parse(response.body) } subject { JSON.parse(response.body) }
@ -219,7 +219,7 @@ shared_examples 'carte_controller_spec' do
stub_request(:get, "http://api-adresse.data.gouv.fr/search?limit=1&q=#{adresse}") stub_request(:get, "http://api-adresse.data.gouv.fr/search?limit=1&q=#{adresse}")
.to_return(status: 200, body: '{"query": "50 avenue des champs u00e9lysu00e9es Paris 75008", "version": "draft", "licence": "ODbL 1.0", "features": [{"geometry": {"coordinates": [2.306888, 48.870374], "type": "Point"}, "type": "Feature", "properties": {"city": "Paris", "label": "50 Avenue des Champs u00c9lysu00e9es 75008 Paris", "housenumber": "50", "id": "ADRNIVX_0000000270748251", "postcode": "75008", "name": "50 Avenue des Champs u00c9lysu00e9es", "citycode": "75108", "context": "75, u00cele-de-France", "score": 0.9054545454545454, "type": "housenumber"}}], "type": "FeatureCollection", "attribution": "BAN"}', headers: {}) .to_return(status: 200, body: '{"query": "50 avenue des champs u00e9lysu00e9es Paris 75008", "version": "draft", "licence": "ODbL 1.0", "features": [{"geometry": {"coordinates": [2.306888, 48.870374], "type": "Point"}, "type": "Feature", "properties": {"city": "Paris", "label": "50 Avenue des Champs u00c9lysu00e9es 75008 Paris", "housenumber": "50", "id": "ADRNIVX_0000000270748251", "postcode": "75008", "name": "50 Avenue des Champs u00c9lysu00e9es", "citycode": "75108", "context": "75, u00cele-de-France", "score": 0.9054545454545454, "type": "housenumber"}}], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
get :get_position, params: {dossier_id: dossier.id} get :get_position, params: { dossier_id: dossier.id }
end end
subject { JSON.parse(response.body) } subject { JSON.parse(response.body) }
@ -245,9 +245,9 @@ shared_examples 'carte_controller_spec' do
before do before do
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter) allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
.to receive(:to_params) .to receive(:to_params)
.and_return({"QPCODE1234" => {:code => "QPCODE1234", :geometry => {:type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]]}}}) .and_return({ "QPCODE1234" => { :code => "QPCODE1234", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } } })
post :get_qp, params: {dossier_id: dossier.id, coordinates: coordinates} post :get_qp, params: { dossier_id: dossier.id, coordinates: coordinates }
end end
context 'when coordinates are empty' do context 'when coordinates are empty' do

View file

@ -2,7 +2,7 @@ require 'spec_helper'
require 'controllers/users/description_controller_shared_example' require 'controllers/users/description_controller_shared_example'
describe Users::DescriptionController, type: :controller, vcr: {cassette_name: 'controllers_users_description_controller'} do describe Users::DescriptionController, type: :controller, vcr: { cassette_name: 'controllers_users_description_controller' } do
let(:owner_user) { create(:user) } let(:owner_user) { create(:user) }
let(:invite_by_user) { create :user, email: 'invite@plop.com' } let(:invite_by_user) { create :user, email: 'invite@plop.com' }
let(:archived_at) { nil } let(:archived_at) { nil }

View file

@ -8,7 +8,7 @@ describe Users::Dossiers::AddSiretController, type: :controller do
sign_in dossier.user sign_in dossier.user
end end
subject { get :show, params: {dossier_id: dossier.id } } subject { get :show, params: { dossier_id: dossier.id } }
context 'when dossier is not attached at a procedure with individual siret attribut' do context 'when dossier is not attached at a procedure with individual siret attribut' do
it { is_expected.to redirect_to users_dossiers_path } it { is_expected.to redirect_to users_dossiers_path }

View file

@ -6,7 +6,7 @@ describe Users::Dossiers::CommentairesController, type: :controller do
describe '#POST create' do describe '#POST create' do
subject { subject {
post :create, params: {dossier_id: dossier.id, texte_commentaire: texte_commentaire} post :create, params: { dossier_id: dossier.id, texte_commentaire: texte_commentaire }
dossier.reload dossier.reload
} }

View file

@ -6,7 +6,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
context 'when email is not set' do context 'when email is not set' do
context 'when user is not connected' do context 'when user is not connected' do
before do before do
get :show, params: {id: invite.id} get :show, params: { id: invite.id }
end end
it { is_expected.to redirect_to new_user_session_path } it { is_expected.to redirect_to new_user_session_path }
@ -18,7 +18,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
before do before do
sign_in invite.user sign_in invite.user
get :show, params: {id: invite.id} get :show, params: { id: invite.id }
end end
it { expect(response.status).to eq 200 } it { expect(response.status).to eq 200 }
@ -27,7 +27,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
context 'when email is set' do context 'when email is set' do
before do before do
get :show, params: {id: invite.id, email: email} get :show, params: { id: invite.id, email: email }
end end
context 'when email is blank' do context 'when email is blank' do
@ -57,7 +57,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
let(:invite) { create :invite, email: email, dossier: (create :dossier) } let(:invite) { create :invite, email: email, dossier: (create :dossier) }
subject { get :show, params: {id: invite.id} } subject { get :show, params: { id: invite.id } }
before do before do
sign_in user sign_in user

View file

@ -27,12 +27,12 @@ describe Users::DossiersController, type: :controller do
sign_in dossier.user sign_in dossier.user
end end
it 'returns http success with dossier_id valid' do it 'returns http success with dossier_id valid' do
get :show, params: {id: dossier_id} get :show, params: { id: dossier_id }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
it 'redirection vers liste dossier si mauvais dossier ID' do it 'redirection vers liste dossier si mauvais dossier ID' do
get :show, params: {id: siret_not_found} get :show, params: { id: siret_not_found }
expect(response).to redirect_to root_path expect(response).to redirect_to root_path
end end
@ -42,7 +42,7 @@ describe Users::DossiersController, type: :controller do
dossier.state = 'en_instruction' dossier.state = 'en_instruction'
dossier.save dossier.save
get :show, params: {id: dossier.id} get :show, params: { id: dossier.id }
end end
it { is_expected.to redirect_to root_path } it { is_expected.to redirect_to root_path }
@ -51,7 +51,7 @@ describe Users::DossiersController, type: :controller do
end end
describe 'GET #new' do describe 'GET #new' do
subject { get :new, params: {procedure_id: procedure_id} } subject { get :new, params: { procedure_id: procedure_id } }
context 'when params procedure_id is present' do context 'when params procedure_id is present' do
context 'when procedure_id is valid' do context 'when procedure_id is valid' do
@ -68,7 +68,7 @@ describe Users::DossiersController, type: :controller do
describe 'save user siret' do describe 'save user siret' do
context 'when user have not a saved siret' do context 'when user have not a saved siret' do
context 'when siret is present on request' do context 'when siret is present on request' do
subject { get :new, params: {procedure_id: procedure_id, siret: siret} } subject { get :new, params: { procedure_id: procedure_id, siret: siret } }
before do before do
subject subject
@ -96,7 +96,7 @@ describe Users::DossiersController, type: :controller do
end end
context 'when siret is present on request' do context 'when siret is present on request' do
subject { get :new, params: {procedure_id: procedure_id, siret: siret} } subject { get :new, params: { procedure_id: procedure_id, siret: siret } }
before do before do
subject subject
@ -203,7 +203,7 @@ describe Users::DossiersController, type: :controller do
sign_in user sign_in user
end end
subject { post :siret_informations, params: {dossier_id: dossier.id, dossier: {siret: example_siret}} } subject { post :siret_informations, params: { dossier_id: dossier.id, dossier: { siret: example_siret } } }
it 'create a dossier' do it 'create a dossier' do
expect { subject }.to change { Dossier.count }.by(0) expect { subject }.to change { Dossier.count }.by(0)
@ -331,7 +331,7 @@ describe Users::DossiersController, type: :controller do
end end
let(:siret_not_found) { '11111111111111' } let(:siret_not_found) { '11111111111111' }
subject { post :siret_informations, params: {dossier_id: dossier.id, dossier: {siret: siret_not_found}} } subject { post :siret_informations, params: { dossier_id: dossier.id, dossier: { siret: siret_not_found } } }
it 'does not create new dossier' do it 'does not create new dossier' do
expect { subject }.not_to change { Dossier.count } expect { subject }.not_to change { Dossier.count }
@ -346,7 +346,7 @@ describe Users::DossiersController, type: :controller do
context 'when REST error 400 is return' do context 'when REST error 400 is return' do
let(:status_entreprise_call) { 400 } let(:status_entreprise_call) { 400 }
subject { post :siret_informations, params: {dossier_id: dossier.id, dossier: {siret: siret}} } subject { post :siret_informations, params: { dossier_id: dossier.id, dossier: { siret: siret } } }
before do before do
sign_in user sign_in user
@ -437,7 +437,7 @@ describe Users::DossiersController, type: :controller do
let!(:dossier_brouillon) { create :dossier, state: "brouillon", user: user } let!(:dossier_brouillon) { create :dossier, state: "brouillon", user: user }
let!(:dossier_not_brouillon) { create :dossier, state: "en_construction", user: user } let!(:dossier_not_brouillon) { create :dossier, state: "en_construction", user: user }
subject { delete :destroy, params: {id: dossier.id} } subject { delete :destroy, params: { id: dossier.id } }
before do before do
sign_in user sign_in user
@ -474,7 +474,7 @@ describe Users::DossiersController, type: :controller do
describe 'PUT #change_siret' do describe 'PUT #change_siret' do
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) } let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
subject { put :change_siret, params: {dossier_id: dossier.id} } subject { put :change_siret, params: { dossier_id: dossier.id } }
before do before do
sign_in user sign_in user
@ -495,7 +495,7 @@ describe Users::DossiersController, type: :controller do
end end
it 'returns http success' do it 'returns http success' do
get :index, params: {liste: :a_traiter} get :index, params: { liste: :a_traiter }
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
end end
@ -508,7 +508,7 @@ describe Users::DossiersController, type: :controller do
end end
it 'returns http success' do it 'returns http success' do
get :index, params: {liste: :en_instruction} get :index, params: { liste: :en_instruction }
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
end end
@ -521,7 +521,7 @@ describe Users::DossiersController, type: :controller do
end end
it 'returns http success' do it 'returns http success' do
get :index, params: {liste: :brouillon} get :index, params: { liste: :brouillon }
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
end end
@ -534,7 +534,7 @@ describe Users::DossiersController, type: :controller do
end end
it 'returns http success' do it 'returns http success' do
get :index, params: {liste: :termine} get :index, params: { liste: :termine }
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
end end
@ -547,7 +547,7 @@ describe Users::DossiersController, type: :controller do
end end
it 'returns http success' do it 'returns http success' do
get :index, params: {liste: :invite} get :index, params: { liste: :invite }
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
end end
@ -560,7 +560,7 @@ describe Users::DossiersController, type: :controller do
end end
it 'returns http success' do it 'returns http success' do
get :index, params: {liste: :list_fake} get :index, params: { liste: :list_fake }
expect(response).to redirect_to(users_dossiers_path) expect(response).to redirect_to(users_dossiers_path)
end end
end end

View file

@ -10,12 +10,12 @@ describe Users::RecapitulatifController, type: :controller do
describe 'GET #show' do describe 'GET #show' do
it 'returns http success' do it 'returns http success' do
get :show, params: {dossier_id: dossier.id} get :show, params: { dossier_id: dossier.id }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
it 'redirection vers siret si mauvais dossier ID' do it 'redirection vers siret si mauvais dossier ID' do
get :show, params: {dossier_id: bad_dossier_id} get :show, params: { dossier_id: bad_dossier_id }
expect(response).to redirect_to('/') expect(response).to redirect_to('/')
end end
@ -27,7 +27,7 @@ describe Users::RecapitulatifController, type: :controller do
dossier.state = 'brouillon' dossier.state = 'brouillon'
dossier.save dossier.save
get :show, params: {dossier_id: dossier.id} get :show, params: { dossier_id: dossier.id }
end end
it { is_expected.to redirect_to root_path } it { is_expected.to redirect_to root_path }
@ -38,7 +38,7 @@ describe Users::RecapitulatifController, type: :controller do
describe 'POST #initiate' do describe 'POST #initiate' do
context 'when an user initiate his dossier' do context 'when an user initiate his dossier' do
before do before do
post :initiate, params: {dossier_id: dossier.id} post :initiate, params: { dossier_id: dossier.id }
end end
it 'dossier change his state for accepte' do it 'dossier change his state for accepte' do

View file

@ -13,7 +13,7 @@ describe Users::SessionsController, type: :controller do
describe 'France Connect attribut' do describe 'France Connect attribut' do
before do before do
post :create, params: {user: {email: user.email, password: user.password}} post :create, params: { user: { email: user.email, password: user.password } }
user.reload user.reload
end end
@ -31,7 +31,7 @@ describe Users::SessionsController, type: :controller do
let(:administrateur) { create(:administrateur, email: email, password: password) } let(:administrateur) { create(:administrateur, email: email, password: password) }
it 'signs user in' do it 'signs user in' do
post :create, params: {user: {email: user.email, password: user.password}} post :create, params: { user: { email: user.email, password: user.password } }
expect(@response.redirect?).to be(true) expect(@response.redirect?).to be(true)
expect(subject.current_user).to eq(user) expect(subject.current_user).to eq(user)
expect(subject.current_gestionnaire).to be(nil) expect(subject.current_gestionnaire).to be(nil)
@ -40,7 +40,7 @@ describe Users::SessionsController, type: :controller do
end end
it 'signs gestionnaire in' do it 'signs gestionnaire in' do
post :create, params: {user: {email: gestionnaire.email, password: gestionnaire.password}} post :create, params: { user: { email: gestionnaire.email, password: gestionnaire.password } }
expect(@response.redirect?).to be(true) expect(@response.redirect?).to be(true)
expect(subject.current_user).to be(nil) expect(subject.current_user).to be(nil)
expect(subject.current_gestionnaire).to eq(gestionnaire) expect(subject.current_gestionnaire).to eq(gestionnaire)
@ -48,7 +48,7 @@ describe Users::SessionsController, type: :controller do
end end
it 'signs administrateur in' do it 'signs administrateur in' do
post :create, params: {user: {email: administrateur.email, password: administrateur.password}} post :create, params: { user: { email: administrateur.email, password: administrateur.password } }
expect(@response.redirect?).to be(true) expect(@response.redirect?).to be(true)
expect(subject.current_user).to be(nil) expect(subject.current_user).to be(nil)
expect(subject.current_gestionnaire).to be(nil) expect(subject.current_gestionnaire).to be(nil)
@ -62,7 +62,7 @@ describe Users::SessionsController, type: :controller do
end end
it 'signs user + gestionnaire + administrateur in' do it 'signs user + gestionnaire + administrateur in' do
post :create, params: {user: {email: administrateur.email, password: administrateur.password}} post :create, params: { user: { email: administrateur.email, password: administrateur.password } }
expect(@response.redirect?).to be(true) expect(@response.redirect?).to be(true)
expect(subject.current_user).to eq(user) expect(subject.current_user).to eq(user)
expect(subject.current_gestionnaire).to eq(gestionnaire) expect(subject.current_gestionnaire).to eq(gestionnaire)
@ -72,7 +72,7 @@ describe Users::SessionsController, type: :controller do
} }
it 'fails to sign in with bad credentials' do it 'fails to sign in with bad credentials' do
post :create, params: {user: {email: user.email, password: 'wrong_password'}} post :create, params: { user: { email: user.email, password: 'wrong_password' } }
expect(@response.unauthorized?).to be(true) expect(@response.unauthorized?).to be(true)
expect(subject.current_user).to be(nil) expect(subject.current_user).to be(nil)
expect(subject.current_gestionnaire).to be(nil) expect(subject.current_gestionnaire).to be(nil)

View file

@ -41,7 +41,7 @@ feature 'As a User I wanna create a dossier' do
end end
end end
scenario 'Identification through siret', vcr: {cassette_name: 'search_ban_paris'}, js: true do scenario 'Identification through siret', vcr: { cassette_name: 'search_ban_paris' }, js: true do
login_as user, scope: :user login_as user, scope: :user
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), only_path: true) expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)

View file

@ -1,13 +1,13 @@
require 'spec_helper' require 'spec_helper'
describe Carto::GeoAPI::Driver do describe Carto::GeoAPI::Driver do
describe '.regions', vcr: {cassette_name: 'geoapi_regions'} do describe '.regions', vcr: { cassette_name: 'geoapi_regions' } do
subject { described_class.regions } subject { described_class.regions }
it { expect(subject.code).to eq 200 } it { expect(subject.code).to eq 200 }
end end
describe '.departements', vcr: {cassette_name: 'geoapi_departements'} do describe '.departements', vcr: { cassette_name: 'geoapi_departements' } do
subject { described_class.departements } subject { described_class.departements }
it { expect(subject.code).to eq 200 } it { expect(subject.code).to eq 200 }

View file

@ -7,7 +7,7 @@ describe CARTO::SGMAP::API do
before do before do
stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search") stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search")
.with(:body => /.*/, .with(:body => /.*/,
:headers => {'Content-Type' => 'application/json'}) :headers => { 'Content-Type' => 'application/json' })
.to_return(status: status, body: body) .to_return(status: status, body: body)
end end
context 'when geojson is empty' do context 'when geojson is empty' do
@ -55,7 +55,7 @@ describe CARTO::SGMAP::API do
before do before do
stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie") stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie")
.with(:body => /.*/, .with(:body => /.*/,
:headers => {'Content-Type' => 'application/json'}) :headers => { 'Content-Type' => 'application/json' })
.to_return(status: status, body: body) .to_return(status: status, body: body)
end end
context 'when geojson is empty' do context 'when geojson is empty' do

View file

@ -6,7 +6,7 @@ describe CARTO::SGMAP::Cadastre::Adapter do
before do before do
stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie") stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie")
.with(:body => /.*/, .with(:body => /.*/,
:headers => {'Content-Type' => 'application/json'}) :headers => { 'Content-Type' => 'application/json' })
.to_return(status: status, body: body) .to_return(status: status, body: body)
end end
@ -51,7 +51,7 @@ describe CARTO::SGMAP::Cadastre::Adapter do
it { expect(subject[:code_com]).to eq('046') } it { expect(subject[:code_com]).to eq('046') }
it { expect(subject[:code_arr]).to eq('000') } it { expect(subject[:code_arr]).to eq('000') }
it { expect(subject[:geometry]).to eq({type: "MultiPolygon", coordinates: [[[[2.4362443, 48.8092078], [2.436384, 48.8092043], [2.4363802, 48.8091414]]]]}) } it { expect(subject[:geometry]).to eq({ type: "MultiPolygon", coordinates: [[[[2.4362443, 48.8092078], [2.436384, 48.8092043], [2.4363802, 48.8091414]]]] }) }
end end
end end

View file

@ -6,7 +6,7 @@ describe CARTO::SGMAP::QuartiersPrioritaires::Adapter do
before do before do
stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search") stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search")
.with(:body => /.*/, .with(:body => /.*/,
:headers => {'Content-Type' => 'application/json'}) :headers => { 'Content-Type' => 'application/json' })
.to_return(status: status, body: body) .to_return(status: status, body: body)
end end
@ -26,7 +26,7 @@ describe CARTO::SGMAP::QuartiersPrioritaires::Adapter do
it { expect(subject[:nom]).to eq('Hauts De Vallières') } it { expect(subject[:nom]).to eq('Hauts De Vallières') }
it { expect(subject[:commune]).to eq('Metz') } it { expect(subject[:commune]).to eq('Metz') }
it { expect(subject[:geometry]).to eq({:type => "MultiPolygon", :coordinates => [[[[6.2136923480551, 49.1342109827851], [6.21416055031881, 49.1338823553928]]]]}) } it { expect(subject[:geometry]).to eq({ :type => "MultiPolygon", :coordinates => [[[[6.2136923480551, 49.1342109827851], [6.21416055031881, 49.1338823553928]]]] }) }
end end
end end

View file

@ -48,7 +48,7 @@ shared_examples 'champ_spec' do
end end
end end
describe '.departement', vcr: {cassette_name: 'call_geo_api_departements'} do describe '.departement', vcr: { cassette_name: 'call_geo_api_departements' } do
subject { Champ.departements } subject { Champ.departements }
it { expect(subject).to include '99 - Étranger' } it { expect(subject).to include '99 - Étranger' }

View file

@ -51,7 +51,7 @@ describe Dossier do
end end
end end
describe '#retrieve_last_piece_justificative_by_type', vcr: {cassette_name: 'models_dossier_retrieve_last_piece_justificative_by_type'} do describe '#retrieve_last_piece_justificative_by_type', vcr: { cassette_name: 'models_dossier_retrieve_last_piece_justificative_by_type' } do
let(:types_de_pj_dossier) { dossier.procedure.types_de_piece_justificative } let(:types_de_pj_dossier) { dossier.procedure.types_de_piece_justificative }
subject { dossier.retrieve_last_piece_justificative_by_type types_de_pj_dossier.first } subject { dossier.retrieve_last_piece_justificative_by_type types_de_pj_dossier.first }

View file

@ -338,7 +338,7 @@ describe Gestionnaire, type: :model do
context 'when a followed dossier has unread notification' do context 'when a followed dossier has unread notification' do
let(:followed_dossier) { dossier_with_no_unread_notification } let(:followed_dossier) { dossier_with_no_unread_notification }
it { is_expected.to eq({ }) } it { is_expected.to eq({}) }
end end
end end

View file

@ -14,7 +14,7 @@ describe ProcedurePresentation do
let (:procedure_presentation) { ProcedurePresentation.find(procedure_presentation_id) } let (:procedure_presentation) { ProcedurePresentation.find(procedure_presentation_id) }
describe "#displayed_fields" do describe "#displayed_fields" do
it { expect(procedure_presentation.displayed_fields).to eq([{"label" => "test1", "table" => "user"}, {"label" => "test2", "table" => "champs"}]) } it { expect(procedure_presentation.displayed_fields).to eq([{ "label" => "test1", "table" => "user" }, { "label" => "test2", "table" => "champs" }]) }
end end
describe "#sort" do describe "#sort" do

View file

@ -14,7 +14,7 @@ describe FranceConnectService do
let(:phone) { '012345678' } let(:phone) { '012345678' }
let(:france_connect_particulier_id) { 'izhikziogjuziegj' } let(:france_connect_particulier_id) { 'izhikziogjuziegj' }
let(:user_info_hash) { {sub: france_connect_particulier_id, given_name: given_name, family_name: family_name, birthdate: birthdate, gender: gender, birthplace: birthplace, email: email, phone: phone} } let(:user_info_hash) { { sub: france_connect_particulier_id, given_name: given_name, family_name: family_name, birthdate: birthdate, gender: gender, birthplace: birthplace, email: email, phone: phone } }
let(:user_info) { instance_double('OpenIDConnect::ResponseObject::UserInfo', raw_attributes: user_info_hash) } let(:user_info) { instance_double('OpenIDConnect::ResponseObject::UserInfo', raw_attributes: user_info_hash) }
subject { described_class.retrieve_user_informations_particulier code } subject { described_class.retrieve_user_informations_particulier code }

View file

@ -123,7 +123,7 @@ RSpec.configure do |config|
if Features.remote_storage if Features.remote_storage
VCR.use_cassette("ovh_storage_init") do VCR.use_cassette("ovh_storage_init") do
CarrierWave.configure do |config| CarrierWave.configure do |config|
config.fog_credentials = {provider: 'OpenStack'} config.fog_credentials = { provider: 'OpenStack' }
end end
end end
end end

View file

@ -4,7 +4,7 @@ RSpec.shared_examples 'not owner of dossier' do |controller, redirect|
let(:dossier_2) { create(:dossier) } let(:dossier_2) { create(:dossier) }
before do before do
get controller, params: {dossier_id: dossier_2.id} get controller, params: { dossier_id: dossier_2.id }
end end
it 'redirect to home page' do it 'redirect to home page' do

View file

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe 'users/description/champs/departements.html.haml', vcr: {cassette_name: 'geoapi_departements'}, type: :view do describe 'users/description/champs/departements.html.haml', vcr: { cassette_name: 'geoapi_departements' }, type: :view do
let(:champ) { create(:champ) } let(:champ) { create(:champ) }
before do before do

View file

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe 'users/description/champs/regions.html.haml', vcr: {cassette_name: 'geoapi_regions'}, type: :view do describe 'users/description/champs/regions.html.haml', vcr: { cassette_name: 'geoapi_regions' }, type: :view do
let(:champ) { create(:champ) } let(:champ) { create(:champ) }
before do before do