Reputation: 6217
An application generates .png
files that get written to the application's public directory.
IO.binwrite("public/ddx/#{@item.id}/c_#{@item.section_id}_#{@item.aisle_id}.png", png.to_s)
However testing the method leads to the test failing to handle a public
directory
Errno::ENOENT: No such file or directory @ rb_sysopen - public/ddx/1622972374/c_2_31.png
the 1622972374
represents item.id
How can minitest be coerced to handling this case?
Upvotes: 0
Views: 229
Reputation: 3811
Don't ask how to code minitest, change your code first, make the image path work on both side
image_path = Rails.root.join('public', 'ddx', ...)
IO.binwrite(image_path, ...)
Upvotes: 1