How to test upload of image with Rails
It's very simple to test image with active storage and with the usage of helper fixture_file_upload:
test "should update project" do img = fixture_file_upload('files/esempio.jpg', 'image/jpg') patch admin_project_url(@project), params: { project: { name: @project.name, body: @project.body, images: [img] } } assert_redirected_to admin_project_url(@project) end