I found it in RSpec docs <https://relishapp.com/rspec/rspec-rails/v/3-5/docs/file-fixture>. SO, instead of *fixture_file_upload*, I had to use file_fixture. Hope this helps. You can customize files location.
On Wednesday, 24 April 2019 17:18:53 UTC+2, belgoros wrote: > > 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/7a18b615-f62e-47f1-87c5-6ebd132fdb0d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
