Files
grecia/spec/models/image_spec.rb
Javi Martín 8eea6f585a Remove hack to allow IO files in Active Storage
We were using this hack in order to allow `File.new` attachments in
tests files. However, we can use the `fixture_file_upload` helper
instead.

Just like it happened with `file_fixture`, this helper method doesn't
work in fixtures, so in this case we're using `Rack::Test::UploadedFile`
instead.
2022-02-23 19:00:33 +01:00

14 lines
399 B
Ruby

require "rails_helper"
describe Image do
it_behaves_like "image validations", "budget_investment_image"
it_behaves_like "image validations", "proposal_image"
it "stores attachments with Active Storage" do
image = create(:image, attachment: fixture_file_upload("clippy.jpg"))
expect(image.attachment).to be_attached
expect(image.attachment.filename).to eq "clippy.jpg"
end
end