From baf69acbcb72bab757e1b8d56e891387db680564 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 16 Oct 2018 00:01:53 +0200 Subject: [PATCH] [Fix #2833] Move /support files to /fixtures --- .../admin/attestation_templates_controller_spec.rb | 12 ++++++------ .../new_gestionnaire/avis_controller_spec.rb | 2 +- .../new_gestionnaire/dossiers_controller_spec.rb | 2 +- .../new_user/dossiers_controller_spec.rb | 2 +- spec/controllers/users/dossiers_controller_spec.rb | 8 ++++---- spec/factories/piece_justificative.rb | 4 ++-- spec/features/new_user/brouillon_spec.rb | 2 +- spec/features/users/complete_demande_spec.rb | 6 +++--- spec/features/users/dossier_creation_spec.rb | 6 +++--- spec/features/users/start_demande_spec.rb | 6 +++--- spec/{support => fixtures}/files/Contrat.pdf | Bin spec/{support => fixtures}/files/RIB.pdf | Bin .../files/api_adresse/search_no_results.json | 0 .../files/api_adresse/search_results.json | 0 .../files/api_carto/request_cadastre.json | 0 .../files/api_carto/request_qp.json | 0 .../files/api_carto/response_cadastre.json | 0 .../files/api_carto/response_qp.json | 0 .../files/api_entreprise/associations.json | 0 .../files/api_entreprise/entreprises.json | 0 .../files/api_entreprise/etablissements.json | 0 .../files/api_entreprise/exercices.json | 0 spec/fixtures/{ => files}/black.png | Bin spec/{support => fixtures}/files/dossierPDF.pdf | Bin spec/fixtures/{ => files}/file.pdf | 0 spec/fixtures/{ => files}/interlaced-black.png | Bin .../files/logo_test_procedure.png | Bin .../files/piece_justificative_0.pdf | Bin .../files/piece_justificative_1.pdf | Bin .../files/piece_justificative_388.pdf | Bin .../files/qp_geometry_value.txt | 0 spec/fixtures/{ => files}/uninterlaced-black.png | Bin spec/fixtures/{ => files}/white.png | Bin spec/lib/api_adresse/address_adapter_spec.rb | 4 ++-- spec/lib/api_carto/api_spec.rb | 10 +++++----- spec/lib/api_carto/cadastre_adapter_spec.rb | 2 +- .../quartiers_prioritaires_adapter_spec.rb | 2 +- spec/lib/api_entreprise/api_spec.rb | 8 ++++---- spec/lib/api_entreprise/entreprise_adapter_spec.rb | 2 +- .../api_entreprise/etablissement_adapter_spec.rb | 2 +- spec/lib/api_entreprise/exercices_adapter_spec.rb | 2 +- spec/lib/api_entreprise/rna_adapter_spec.rb | 2 +- spec/models/attestation_template_spec.rb | 8 ++++---- spec/models/piece_justificative_spec.rb | 2 +- spec/models/procedure_spec.rb | 4 ++-- spec/models/quartier_prioritaire_spec.rb | 2 +- spec/services/commentaire_service_spec.rb | 2 +- spec/views/admin/procedures/edit.html.haml_spec.rb | 2 +- 48 files changed, 52 insertions(+), 52 deletions(-) rename spec/{support => fixtures}/files/Contrat.pdf (100%) rename spec/{support => fixtures}/files/RIB.pdf (100%) rename spec/{support => fixtures}/files/api_adresse/search_no_results.json (100%) rename spec/{support => fixtures}/files/api_adresse/search_results.json (100%) rename spec/{support => fixtures}/files/api_carto/request_cadastre.json (100%) rename spec/{support => fixtures}/files/api_carto/request_qp.json (100%) rename spec/{support => fixtures}/files/api_carto/response_cadastre.json (100%) rename spec/{support => fixtures}/files/api_carto/response_qp.json (100%) rename spec/{support => fixtures}/files/api_entreprise/associations.json (100%) rename spec/{support => fixtures}/files/api_entreprise/entreprises.json (100%) rename spec/{support => fixtures}/files/api_entreprise/etablissements.json (100%) rename spec/{support => fixtures}/files/api_entreprise/exercices.json (100%) rename spec/fixtures/{ => files}/black.png (100%) rename spec/{support => fixtures}/files/dossierPDF.pdf (100%) rename spec/fixtures/{ => files}/file.pdf (100%) rename spec/fixtures/{ => files}/interlaced-black.png (100%) rename spec/{support => fixtures}/files/logo_test_procedure.png (100%) rename spec/{support => fixtures}/files/piece_justificative_0.pdf (100%) rename spec/{support => fixtures}/files/piece_justificative_1.pdf (100%) rename spec/{support => fixtures}/files/piece_justificative_388.pdf (100%) rename spec/{support => fixtures}/files/qp_geometry_value.txt (100%) rename spec/fixtures/{ => files}/uninterlaced-black.png (100%) rename spec/fixtures/{ => files}/white.png (100%) diff --git a/spec/controllers/admin/attestation_templates_controller_spec.rb b/spec/controllers/admin/attestation_templates_controller_spec.rb index 6939e477e..f72e07227 100644 --- a/spec/controllers/admin/attestation_templates_controller_spec.rb +++ b/spec/controllers/admin/attestation_templates_controller_spec.rb @@ -3,12 +3,12 @@ describe Admin::AttestationTemplatesController, type: :controller do let!(:attestation_template) { create(:attestation_template) } let(:admin) { create(:administrateur) } let!(:procedure) { create :procedure, administrateur: admin, attestation_template: attestation_template } - let(:logo) { fixture_file_upload('spec/fixtures/white.png', 'image/png') } - let(:logo2) { fixture_file_upload('spec/fixtures/white.png', 'image/png') } - let(:signature) { fixture_file_upload('spec/fixtures/black.png', 'image/png') } - let(:signature2) { fixture_file_upload('spec/fixtures/black.png', 'image/png') } - let(:interlaced_logo) { fixture_file_upload('spec/fixtures/interlaced-black.png', 'image/png') } - let(:uninterlaced_logo) { fixture_file_upload('spec/fixtures/uninterlaced-black.png', 'image/png') } + let(:logo) { fixture_file_upload('spec/fixtures/files/white.png', 'image/png') } + let(:logo2) { fixture_file_upload('spec/fixtures/files/white.png', 'image/png') } + let(:signature) { fixture_file_upload('spec/fixtures/files/black.png', 'image/png') } + let(:signature2) { fixture_file_upload('spec/fixtures/files/black.png', 'image/png') } + let(:interlaced_logo) { fixture_file_upload('spec/fixtures/files/interlaced-black.png', 'image/png') } + let(:uninterlaced_logo) { fixture_file_upload('spec/fixtures/files/uninterlaced-black.png', 'image/png') } before do sign_in admin diff --git a/spec/controllers/new_gestionnaire/avis_controller_spec.rb b/spec/controllers/new_gestionnaire/avis_controller_spec.rb index 09de77c53..08c0f980c 100644 --- a/spec/controllers/new_gestionnaire/avis_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/avis_controller_spec.rb @@ -81,7 +81,7 @@ describe NewGestionnaire::AvisController, type: :controller do end context "with a file" do - let(:file) { Rack::Test::UploadedFile.new("./spec/support/files/piece_justificative_0.pdf", 'application/pdf') } + let(:file) { Rack::Test::UploadedFile.new("./spec/fixtures/files/piece_justificative_0.pdf", 'application/pdf') } it do subject diff --git a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb index 6509895ac..8df4828d7 100644 --- a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb @@ -267,7 +267,7 @@ describe NewGestionnaire::DossiersController, type: :controller do describe "#create_commentaire" do let(:saved_commentaire) { dossier.commentaires.first } let(:body) { "avant\napres" } - let(:file) { Rack::Test::UploadedFile.new("./spec/support/files/piece_justificative_0.pdf", 'application/pdf') } + let(:file) { Rack::Test::UploadedFile.new("./spec/fixtures/files/piece_justificative_0.pdf", 'application/pdf') } let(:scan_result) { true } subject { diff --git a/spec/controllers/new_user/dossiers_controller_spec.rb b/spec/controllers/new_user/dossiers_controller_spec.rb index 361386ddc..ba818a0eb 100644 --- a/spec/controllers/new_user/dossiers_controller_spec.rb +++ b/spec/controllers/new_user/dossiers_controller_spec.rb @@ -617,7 +617,7 @@ describe NewUser::DossiersController, type: :controller do let(:dossier) { create(:dossier, :en_construction, user: user) } let(:saved_commentaire) { dossier.commentaires.first } let(:body) { "avant\napres" } - let(:file) { Rack::Test::UploadedFile.new("./spec/support/files/piece_justificative_0.pdf", 'application/pdf') } + let(:file) { Rack::Test::UploadedFile.new("./spec/fixtures/files/piece_justificative_0.pdf", 'application/pdf') } let(:scan_result) { true } subject { diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index 5d952d491..6201d9de0 100644 --- a/spec/controllers/users/dossiers_controller_spec.rb +++ b/spec/controllers/users/dossiers_controller_spec.rb @@ -15,7 +15,7 @@ describe Users::DossiersController, type: :controller do let(:user) { create :user } let(:exercices_status) { 200 } - let(:exercices_body) { File.read('spec/support/files/api_entreprise/exercices.json') } + let(:exercices_body) { File.read('spec/fixtures/files/api_entreprise/exercices.json') } let(:siren) { '440117620' } let(:siret) { '44011762001530' } @@ -199,10 +199,10 @@ describe Users::DossiersController, type: :controller do .to_return(status: 404, body: 'fake body') stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) - .to_return(status: status_entreprise_call, body: File.read('spec/support/files/api_entreprise/etablissements.json')) + .to_return(status: status_entreprise_call, body: File.read('spec/fixtures/files/api_entreprise/etablissements.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) - .to_return(status: status_entreprise_call, body: File.read('spec/support/files/api_entreprise/entreprises.json')) + .to_return(status: status_entreprise_call, body: File.read('spec/fixtures/files/api_entreprise/entreprises.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) .to_return(status: exercices_status, body: exercices_body) @@ -280,7 +280,7 @@ describe Users::DossiersController, type: :controller do context 'when siren have rna informations' do let(:rna_status) { 200 } - let(:rna_body) { File.read('spec/support/files/api_entreprise/associations.json') } + let(:rna_body) { File.read('spec/fixtures/files/api_entreprise/associations.json') } it 'creates rna information for entreprise' do subject diff --git a/spec/factories/piece_justificative.rb b/spec/factories/piece_justificative.rb index e204bdba4..d60b935f0 100644 --- a/spec/factories/piece_justificative.rb +++ b/spec/factories/piece_justificative.rb @@ -1,11 +1,11 @@ FactoryBot.define do factory :piece_justificative do trait :rib do - content { Rack::Test::UploadedFile.new("./spec/support/files/RIB.pdf", 'application/pdf') } + content { Rack::Test::UploadedFile.new("./spec/fixtures/files/RIB.pdf", 'application/pdf') } end trait :contrat do - content { Rack::Test::UploadedFile.new("./spec/support/files/Contrat.pdf", 'application/pdf') } + content { Rack::Test::UploadedFile.new("./spec/fixtures/files/Contrat.pdf", 'application/pdf') } end end end diff --git a/spec/features/new_user/brouillon_spec.rb b/spec/features/new_user/brouillon_spec.rb index 4ffe73bae..cfe5f6185 100644 --- a/spec/features/new_user/brouillon_spec.rb +++ b/spec/features/new_user/brouillon_spec.rb @@ -39,7 +39,7 @@ feature 'The user' do check('engagement') fill_in('dossier_link', with: '123') # do not know how to make it work... - # find('form input[type="file"]').set(Rails.root.join('spec/fixtures/white.png')) + # find('form input[type="file"]').set(Rails.root.join('spec/fixtures/files/white.png')) click_on 'Enregistrer le brouillon' diff --git a/spec/features/users/complete_demande_spec.rb b/spec/features/users/complete_demande_spec.rb index 2de695d97..725e5135f 100644 --- a/spec/features/users/complete_demande_spec.rb +++ b/spec/features/users/complete_demande_spec.rb @@ -31,12 +31,12 @@ feature 'user path for dossier creation' do context 'sets siret' do before do stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) - .to_return(body: File.read('spec/support/files/api_entreprise/etablissements.json', status: 200)) + .to_return(body: File.read('spec/fixtures/files/api_entreprise/etablissements.json', status: 200)) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) - .to_return(status: 200, body: File.read('spec/support/files/api_entreprise/entreprises.json')) + .to_return(status: 200, body: File.read('spec/fixtures/files/api_entreprise/entreprises.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) - .to_return(status: 200, body: File.read('spec/support/files/api_entreprise/exercices.json')) + .to_return(status: 200, body: File.read('spec/fixtures/files/api_entreprise/exercices.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) .to_return(status: 404, body: '') diff --git a/spec/features/users/dossier_creation_spec.rb b/spec/features/users/dossier_creation_spec.rb index 8db07b62e..adc24535f 100644 --- a/spec/features/users/dossier_creation_spec.rb +++ b/spec/features/users/dossier_creation_spec.rb @@ -67,11 +67,11 @@ feature 'As a User I wanna create a dossier' do expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s)) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) - .to_return(status: 200, body: File.read('spec/support/files/api_entreprise/etablissements.json')) + .to_return(status: 200, body: File.read('spec/fixtures/files/api_entreprise/etablissements.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) - .to_return(status: 200, body: File.read('spec/support/files/api_entreprise/entreprises.json')) + .to_return(status: 200, body: File.read('spec/fixtures/files/api_entreprise/entreprises.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) - .to_return(status: 200, body: File.read('spec/support/files/api_entreprise/exercices.json')) + .to_return(status: 200, body: File.read('spec/fixtures/files/api_entreprise/exercices.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) .to_return(status: 404, body: '') diff --git a/spec/features/users/start_demande_spec.rb b/spec/features/users/start_demande_spec.rb index ad7937318..5cd48a6b4 100644 --- a/spec/features/users/start_demande_spec.rb +++ b/spec/features/users/start_demande_spec.rb @@ -27,11 +27,11 @@ feature 'user arrive on siret page' do context 'when enter a siret', js: true do before do stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) - .to_return(status: 200, body: File.read('spec/support/files/api_entreprise/etablissements.json')) + .to_return(status: 200, body: File.read('spec/fixtures/files/api_entreprise/etablissements.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) - .to_return(status: 200, body: File.read('spec/support/files/api_entreprise/entreprises.json')) + .to_return(status: 200, body: File.read('spec/fixtures/files/api_entreprise/entreprises.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/) - .to_return(status: 200, body: File.read('spec/support/files/api_entreprise/exercices.json')) + .to_return(status: 200, body: File.read('spec/fixtures/files/api_entreprise/exercices.json')) stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/) .to_return(status: 404, body: '') diff --git a/spec/support/files/Contrat.pdf b/spec/fixtures/files/Contrat.pdf similarity index 100% rename from spec/support/files/Contrat.pdf rename to spec/fixtures/files/Contrat.pdf diff --git a/spec/support/files/RIB.pdf b/spec/fixtures/files/RIB.pdf similarity index 100% rename from spec/support/files/RIB.pdf rename to spec/fixtures/files/RIB.pdf diff --git a/spec/support/files/api_adresse/search_no_results.json b/spec/fixtures/files/api_adresse/search_no_results.json similarity index 100% rename from spec/support/files/api_adresse/search_no_results.json rename to spec/fixtures/files/api_adresse/search_no_results.json diff --git a/spec/support/files/api_adresse/search_results.json b/spec/fixtures/files/api_adresse/search_results.json similarity index 100% rename from spec/support/files/api_adresse/search_results.json rename to spec/fixtures/files/api_adresse/search_results.json diff --git a/spec/support/files/api_carto/request_cadastre.json b/spec/fixtures/files/api_carto/request_cadastre.json similarity index 100% rename from spec/support/files/api_carto/request_cadastre.json rename to spec/fixtures/files/api_carto/request_cadastre.json diff --git a/spec/support/files/api_carto/request_qp.json b/spec/fixtures/files/api_carto/request_qp.json similarity index 100% rename from spec/support/files/api_carto/request_qp.json rename to spec/fixtures/files/api_carto/request_qp.json diff --git a/spec/support/files/api_carto/response_cadastre.json b/spec/fixtures/files/api_carto/response_cadastre.json similarity index 100% rename from spec/support/files/api_carto/response_cadastre.json rename to spec/fixtures/files/api_carto/response_cadastre.json diff --git a/spec/support/files/api_carto/response_qp.json b/spec/fixtures/files/api_carto/response_qp.json similarity index 100% rename from spec/support/files/api_carto/response_qp.json rename to spec/fixtures/files/api_carto/response_qp.json diff --git a/spec/support/files/api_entreprise/associations.json b/spec/fixtures/files/api_entreprise/associations.json similarity index 100% rename from spec/support/files/api_entreprise/associations.json rename to spec/fixtures/files/api_entreprise/associations.json diff --git a/spec/support/files/api_entreprise/entreprises.json b/spec/fixtures/files/api_entreprise/entreprises.json similarity index 100% rename from spec/support/files/api_entreprise/entreprises.json rename to spec/fixtures/files/api_entreprise/entreprises.json diff --git a/spec/support/files/api_entreprise/etablissements.json b/spec/fixtures/files/api_entreprise/etablissements.json similarity index 100% rename from spec/support/files/api_entreprise/etablissements.json rename to spec/fixtures/files/api_entreprise/etablissements.json diff --git a/spec/support/files/api_entreprise/exercices.json b/spec/fixtures/files/api_entreprise/exercices.json similarity index 100% rename from spec/support/files/api_entreprise/exercices.json rename to spec/fixtures/files/api_entreprise/exercices.json diff --git a/spec/fixtures/black.png b/spec/fixtures/files/black.png similarity index 100% rename from spec/fixtures/black.png rename to spec/fixtures/files/black.png diff --git a/spec/support/files/dossierPDF.pdf b/spec/fixtures/files/dossierPDF.pdf similarity index 100% rename from spec/support/files/dossierPDF.pdf rename to spec/fixtures/files/dossierPDF.pdf diff --git a/spec/fixtures/file.pdf b/spec/fixtures/files/file.pdf similarity index 100% rename from spec/fixtures/file.pdf rename to spec/fixtures/files/file.pdf diff --git a/spec/fixtures/interlaced-black.png b/spec/fixtures/files/interlaced-black.png similarity index 100% rename from spec/fixtures/interlaced-black.png rename to spec/fixtures/files/interlaced-black.png diff --git a/spec/support/files/logo_test_procedure.png b/spec/fixtures/files/logo_test_procedure.png similarity index 100% rename from spec/support/files/logo_test_procedure.png rename to spec/fixtures/files/logo_test_procedure.png diff --git a/spec/support/files/piece_justificative_0.pdf b/spec/fixtures/files/piece_justificative_0.pdf similarity index 100% rename from spec/support/files/piece_justificative_0.pdf rename to spec/fixtures/files/piece_justificative_0.pdf diff --git a/spec/support/files/piece_justificative_1.pdf b/spec/fixtures/files/piece_justificative_1.pdf similarity index 100% rename from spec/support/files/piece_justificative_1.pdf rename to spec/fixtures/files/piece_justificative_1.pdf diff --git a/spec/support/files/piece_justificative_388.pdf b/spec/fixtures/files/piece_justificative_388.pdf similarity index 100% rename from spec/support/files/piece_justificative_388.pdf rename to spec/fixtures/files/piece_justificative_388.pdf diff --git a/spec/support/files/qp_geometry_value.txt b/spec/fixtures/files/qp_geometry_value.txt similarity index 100% rename from spec/support/files/qp_geometry_value.txt rename to spec/fixtures/files/qp_geometry_value.txt diff --git a/spec/fixtures/uninterlaced-black.png b/spec/fixtures/files/uninterlaced-black.png similarity index 100% rename from spec/fixtures/uninterlaced-black.png rename to spec/fixtures/files/uninterlaced-black.png diff --git a/spec/fixtures/white.png b/spec/fixtures/files/white.png similarity index 100% rename from spec/fixtures/white.png rename to spec/fixtures/files/white.png diff --git a/spec/lib/api_adresse/address_adapter_spec.rb b/spec/lib/api_adresse/address_adapter_spec.rb index f94a3caa1..31a1d7bc3 100644 --- a/spec/lib/api_adresse/address_adapter_spec.rb +++ b/spec/lib/api_adresse/address_adapter_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe ApiAdresse::AddressAdapter do describe '#get_suggestions' do let(:request) { 'Paris' } - let(:response) { File.open('spec/support/files/api_adresse/search_results.json') } + let(:response) { File.open('spec/fixtures/files/api_adresse/search_results.json') } let(:status) { 200 } subject { described_class.new(request).get_suggestions } @@ -19,7 +19,7 @@ describe ApiAdresse::AddressAdapter do end context 'when address return an empty list' do - let(:response) { File.open('spec/support/files/api_adresse/search_no_results.json') } + let(:response) { File.open('spec/fixtures/files/api_adresse/search_no_results.json') } it { expect(subject.size).to eq 0 } it { is_expected.to be_an_instance_of Array } diff --git a/spec/lib/api_carto/api_spec.rb b/spec/lib/api_carto/api_spec.rb index f7cc8ed42..900debfda 100644 --- a/spec/lib/api_carto/api_spec.rb +++ b/spec/lib/api_carto/api_spec.rb @@ -21,7 +21,7 @@ describe ApiCarto::API do end context 'when request return 500' do - let(:geojson) { File.read('spec/support/files/api_carto/request_qp.json') } + let(:geojson) { File.read('spec/fixtures/files/api_carto/request_qp.json') } let(:status) { 500 } let(:body) { 'toto' } @@ -31,7 +31,7 @@ describe ApiCarto::API do end context 'when geojson exist' do - let(:geojson) { File.read('spec/support/files/api_carto/request_qp.json') } + let(:geojson) { File.read('spec/fixtures/files/api_carto/request_qp.json') } let(:status) { 200 } let(:body) { 'toto' } @@ -40,7 +40,7 @@ describe ApiCarto::API do end context 'when geojson is at format JSON' do - let(:geojson) { JSON.parse(File.read('spec/support/files/api_carto/request_qp.json')) } + let(:geojson) { JSON.parse(File.read('spec/fixtures/files/api_carto/request_qp.json')) } it 'returns response body' do expect(subject).to eq(body) @@ -69,7 +69,7 @@ describe ApiCarto::API do end context 'when geojson exist' do - let(:geojson) { File.read('spec/support/files/api_carto/request_cadastre.json') } + let(:geojson) { File.read('spec/fixtures/files/api_carto/request_cadastre.json') } let(:status) { 200 } let(:body) { 'toto' } @@ -78,7 +78,7 @@ describe ApiCarto::API do end context 'when geojson is at format JSON' do - let(:geojson) { JSON.parse(File.read('spec/support/files/api_carto/request_cadastre.json')) } + let(:geojson) { JSON.parse(File.read('spec/fixtures/files/api_carto/request_cadastre.json')) } it 'returns response body' do expect(subject).to eq(body) diff --git a/spec/lib/api_carto/cadastre_adapter_spec.rb b/spec/lib/api_carto/cadastre_adapter_spec.rb index 2dba88a82..6aa2858ca 100644 --- a/spec/lib/api_carto/cadastre_adapter_spec.rb +++ b/spec/lib/api_carto/cadastre_adapter_spec.rb @@ -13,7 +13,7 @@ describe ApiCarto::CadastreAdapter do context 'coordinates are filled' do let(:coordinates) { '[[2.252728, 43.27151][2.323223, 32.835332]]' } let(:status) { 200 } - let(:body) { File.read('spec/support/files/api_carto/response_cadastre.json') } + let(:body) { File.read('spec/fixtures/files/api_carto/response_cadastre.json') } it { expect(subject).to be_a_instance_of(Array) } it { expect(subject.size).to eq(16) } diff --git a/spec/lib/api_carto/quartiers_prioritaires_adapter_spec.rb b/spec/lib/api_carto/quartiers_prioritaires_adapter_spec.rb index 24ffcc5e8..b4ac7ef3a 100644 --- a/spec/lib/api_carto/quartiers_prioritaires_adapter_spec.rb +++ b/spec/lib/api_carto/quartiers_prioritaires_adapter_spec.rb @@ -13,7 +13,7 @@ describe ApiCarto::QuartiersPrioritairesAdapter do context 'coordinates are filled' do let(:coordinates) { '[[2.252728, 43.27151][2.323223, 32.835332]]' } let(:status) { 200 } - let(:body) { File.read('spec/support/files/api_carto/response_qp.json') } + let(:body) { File.read('spec/fixtures/files/api_carto/response_qp.json') } it { expect(subject).to be_a_instance_of(Array) } diff --git a/spec/lib/api_entreprise/api_spec.rb b/spec/lib/api_entreprise/api_spec.rb index 2dffe6ae6..c0dcaeb84 100644 --- a/spec/lib/api_entreprise/api_spec.rb +++ b/spec/lib/api_entreprise/api_spec.rb @@ -20,7 +20,7 @@ describe ApiEntreprise::API do context 'when siret exist' do let(:siren) { '418166096' } let(:status) { 200 } - let(:body) { File.read('spec/support/files/api_entreprise/entreprises.json') } + let(:body) { File.read('spec/fixtures/files/api_entreprise/entreprises.json') } it 'returns response body' do expect(subject).to eq(JSON.parse(body, symbolize_names: true)) @@ -48,7 +48,7 @@ describe ApiEntreprise::API do context 'when siret exists' do let(:siret) { '41816609600051' } let(:status) { 200 } - let(:body) { File.read('spec/support/files/api_entreprise/etablissements.json') } + let(:body) { File.read('spec/fixtures/files/api_entreprise/etablissements.json') } it 'returns body' do expect(subject).to eq(JSON.parse(body, symbolize_names: true)) @@ -79,7 +79,7 @@ describe ApiEntreprise::API do let(:siret) { '41816609600051' } let(:status) { 200 } - let(:body) { File.read('spec/support/files/api_entreprise/exercices.json') } + let(:body) { File.read('spec/fixtures/files/api_entreprise/exercices.json') } it 'raises RestClient::Unauthorized' do expect(subject).to eq(JSON.parse(body, symbolize_names: true)) @@ -108,7 +108,7 @@ describe ApiEntreprise::API do context 'when siren exists' do let(:siren) { '418166096' } let(:status) { 200 } - let(:body) { File.read('spec/support/files/api_entreprise/associations.json') } + let(:body) { File.read('spec/fixtures/files/api_entreprise/associations.json') } it { expect(subject).to eq(JSON.parse(body, symbolize_names: true)) } end diff --git a/spec/lib/api_entreprise/entreprise_adapter_spec.rb b/spec/lib/api_entreprise/entreprise_adapter_spec.rb index 75328fe9c..a8559c024 100644 --- a/spec/lib/api_entreprise/entreprise_adapter_spec.rb +++ b/spec/lib/api_entreprise/entreprise_adapter_spec.rb @@ -8,7 +8,7 @@ describe ApiEntreprise::EntrepriseAdapter do before do stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/) - .to_return(body: File.read('spec/support/files/api_entreprise/entreprises.json', status: 200)) + .to_return(body: File.read('spec/fixtures/files/api_entreprise/entreprises.json', status: 200)) end it '#to_params class est une Hash ?' do diff --git a/spec/lib/api_entreprise/etablissement_adapter_spec.rb b/spec/lib/api_entreprise/etablissement_adapter_spec.rb index e2224bdbe..86646148f 100644 --- a/spec/lib/api_entreprise/etablissement_adapter_spec.rb +++ b/spec/lib/api_entreprise/etablissement_adapter_spec.rb @@ -9,7 +9,7 @@ describe ApiEntreprise::EtablissementAdapter do before do stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/) - .to_return(body: File.read('spec/support/files/api_entreprise/etablissements.json', status: 200)) + .to_return(body: File.read('spec/fixtures/files/api_entreprise/etablissements.json', status: 200)) end it '#to_params class est une Hash ?' do diff --git a/spec/lib/api_entreprise/exercices_adapter_spec.rb b/spec/lib/api_entreprise/exercices_adapter_spec.rb index 36c5cbb8b..d7cfb7aca 100644 --- a/spec/lib/api_entreprise/exercices_adapter_spec.rb +++ b/spec/lib/api_entreprise/exercices_adapter_spec.rb @@ -7,7 +7,7 @@ describe ApiEntreprise::ExercicesAdapter do before do stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/.*token=/) - .to_return(body: File.read('spec/support/files/api_entreprise/exercices.json', status: 200)) + .to_return(body: File.read('spec/fixtures/files/api_entreprise/exercices.json', status: 200)) end it '#to_params class est un Hash ?' do diff --git a/spec/lib/api_entreprise/rna_adapter_spec.rb b/spec/lib/api_entreprise/rna_adapter_spec.rb index 2b246d54f..6e54eb058 100644 --- a/spec/lib/api_entreprise/rna_adapter_spec.rb +++ b/spec/lib/api_entreprise/rna_adapter_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe ApiEntreprise::RNAAdapter do let(:siret) { '50480511000013' } let(:procedure_id) { 22 } - let(:body) { File.read('spec/support/files/api_entreprise/associations.json') } + let(:body) { File.read('spec/fixtures/files/api_entreprise/associations.json') } let(:status) { 200 } let(:adapter) { described_class.new(siret, procedure_id) } diff --git a/spec/models/attestation_template_spec.rb b/spec/models/attestation_template_spec.rb index 0a0ff4dcc..f5b6786f4 100644 --- a/spec/models/attestation_template_spec.rb +++ b/spec/models/attestation_template_spec.rb @@ -57,8 +57,8 @@ describe AttestationTemplate, type: :model do describe 'dup' do before do - @logo = File.open('spec/fixtures/white.png') - @signature = File.open('spec/fixtures/black.png') + @logo = File.open('spec/fixtures/files/white.png') + @signature = File.open('spec/fixtures/files/black.png') end after do @@ -113,8 +113,8 @@ describe AttestationTemplate, type: :model do end before do - @logo = File.open('spec/fixtures/white.png') - @signature = File.open('spec/fixtures/black.png') + @logo = File.open('spec/fixtures/files/white.png') + @signature = File.open('spec/fixtures/files/black.png') Timecop.freeze(Time.now) end diff --git a/spec/models/piece_justificative_spec.rb b/spec/models/piece_justificative_spec.rb index 0cfd6aee2..f6113af24 100644 --- a/spec/models/piece_justificative_spec.rb +++ b/spec/models/piece_justificative_spec.rb @@ -13,7 +13,7 @@ describe PieceJustificative do subject { piece_justificative.empty? } context 'when content exist' do - let(:content) { File.open('./spec/support/files/piece_justificative_388.pdf') } + let(:content) { File.open('./spec/fixtures/files/piece_justificative_388.pdf') } it { is_expected.to be_falsey } end end diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb index d97829d03..cffd74f0d 100644 --- a/spec/models/procedure_spec.rb +++ b/spec/models/procedure_spec.rb @@ -345,8 +345,8 @@ describe Procedure do let(:from_library) { false } before do - @logo = File.open('spec/fixtures/white.png') - @signature = File.open('spec/fixtures/black.png') + @logo = File.open('spec/fixtures/files/white.png') + @signature = File.open('spec/fixtures/files/black.png') @attestation_template = create(:attestation_template, procedure: procedure, logo: @logo, signature: @signature) @procedure = procedure.clone(procedure.administrateur, from_library) @procedure.save diff --git a/spec/models/quartier_prioritaire_spec.rb b/spec/models/quartier_prioritaire_spec.rb index 6295ad74e..fa84ab8ed 100644 --- a/spec/models/quartier_prioritaire_spec.rb +++ b/spec/models/quartier_prioritaire_spec.rb @@ -10,7 +10,7 @@ describe QuartierPrioritaire do describe 'geometry' do let(:qp) { create :quartier_prioritaire, geometry: qp_geometry } - let(:qp_geometry) { File.open('spec/support/files/qp_geometry_value.txt').read } + let(:qp_geometry) { File.open('spec/fixtures/files/qp_geometry_value.txt').read } subject { qp.geometry } diff --git a/spec/services/commentaire_service_spec.rb b/spec/services/commentaire_service_spec.rb index 7029d0c47..55e5f3115 100644 --- a/spec/services/commentaire_service_spec.rb +++ b/spec/services/commentaire_service_spec.rb @@ -32,7 +32,7 @@ describe CommentaireService do end context 'when it has a file' do - let(:file) { Rack::Test::UploadedFile.new("./spec/support/files/piece_justificative_0.pdf", 'application/pdf') } + let(:file) { Rack::Test::UploadedFile.new("./spec/fixtures/files/piece_justificative_0.pdf", 'application/pdf') } it 'saves the attached file' do expect(commentaire.file).to be_present diff --git a/spec/views/admin/procedures/edit.html.haml_spec.rb b/spec/views/admin/procedures/edit.html.haml_spec.rb index 3e928fe08..28d4cc71b 100644 --- a/spec/views/admin/procedures/edit.html.haml_spec.rb +++ b/spec/views/admin/procedures/edit.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'admin/procedures/edit.html.haml', type: :view, vcr: { cassette_name: 'admin_procedure_edit' } do - let(:logo) { Rack::Test::UploadedFile.new("./spec/support/files/logo_test_procedure.png", 'image/png') } + let(:logo) { Rack::Test::UploadedFile.new("./spec/fixtures/files/logo_test_procedure.png", 'image/png') } let(:procedure) { create(:procedure, logo: logo) } before do