Testing File Uploads in Rails with Shrine Discussion
This is great! Can we add system tests too? How can we write a system test to create photo and update photos?
Here's how I'd system test
"""
class PhotosTest < ApplicationSystemTestCase
test "create" do
visit new_photos_url
attach_file("photos_image", "test/fixtures/files/test.png")
click_on "Create Photo"
assert_equal 'test.png', JSON.parse(Photo.last.image_data)['metadata']['filename']
end
end
"""
Hey Chris! Great work as always! It's not that is hard to be honest, but I think it would be great and mostly helpful to have in the description of the video any previous related episode to this one. In that way, we can simply watch it beforehand, without having to look for it ourselves.