specs: use fixture_file_upload rather than Rack::Test::UploadedFile

This is mostly for consistency (both styles were used before).

Note: we still have to use `Rack::Test::UploadedFile.new` in factories,
because of https://github.com/thoughtbot/factory_bot/issues/385.
This commit is contained in:
Pierre de La Morinerie 2020-06-30 15:53:54 +00:00
parent dbba5644e3
commit 43569f687e
16 changed files with 28 additions and 28 deletions

View file

@ -191,7 +191,7 @@ describe Procedure do
context 'when the deliberation is uploaded ' do
before do
procedure.deliberation = Rack::Test::UploadedFile.new('spec/fixtures/files/file.pdf', 'application/pdf')
procedure.deliberation = fixture_file_upload('spec/fixtures/files/file.pdf', 'application/pdf')
end
it { expect(procedure.valid?).to eq(true) }
@ -199,7 +199,7 @@ describe Procedure do
context 'when the deliberation is uploaded with an unauthorized format' do
before do
procedure.deliberation = Rack::Test::UploadedFile.new('spec/fixtures/files/french-flag.gif', 'image/gif')
procedure.deliberation = fixture_file_upload('spec/fixtures/files/french-flag.gif', 'image/gif')
end
it { expect(procedure.valid?).to eq(false) }
@ -952,7 +952,7 @@ describe Procedure do
p.reload
expect(p.juridique_required).to be_falsey
@deliberation = Rack::Test::UploadedFile.new('spec/fixtures/files/file.pdf', 'application/pdf')
@deliberation = fixture_file_upload('spec/fixtures/files/file.pdf', 'application/pdf')
p.update(deliberation: @deliberation)
p.reload
expect(p.juridique_required).to be_truthy