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
<https://github.com/rspec/rspec-rails/issues/1554> and 1943
<https://github.com/rspec/rspec-rails/pull/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
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/27712b72-b12d-444c-bb13-79c5ee79b737%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.