I still can't figure out the right way to use
fixture_file_upload method in a request spec.
I looked through several issues:
1554 and
1943, but still no success.
I put an image rails.jpeg in spec/fixtures folder.
Here is an example that fails:
describe 'PATCH /shops/:shop_identifer' do
let(:photo) {fixture_file_upload('files/rails.jpeg') }
let(:valid_params) do
ams_json(
Shop,
category: shop.category,
country: shop.country,
identifier: shop.identifier,
modified_by: shop.modified_by,
name: 'new name',
photo: photo,
status: shop.status
)
end
before { patch "/shops/#{shop.identifier}", params: valid_params, headers: headers }
...
it 'creates a blob ' do
expect(shop.photo.attached?).to be true
end
It fails with:
RuntimeError:
files/rails.jpeg file does not exist
What am I missing?
RSpec version: 3.8.1
Rails version: 5.2.0