Merge pull request #2841 from betagouv/fix-2833
[Fix #2833] Move /fixtures files to /support
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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: '')
|
||||
|
||||
|
|
|
@ -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: '')
|
||||
|
||||
|
|
|
@ -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: '')
|
||||
|
||||
|
|
Before Width: | Height: | Size: 67 B After Width: | Height: | Size: 67 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 67 B After Width: | Height: | Size: 67 B |
|
@ -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 }
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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) }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|