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.
This commit is contained in:
@@ -21,7 +21,7 @@ shared_examples "image validations" do |imageable_factory|
|
||||
it "is valid for all accepted content types" do
|
||||
acceptedcontenttypes.each do |content_type|
|
||||
extension = content_type.split("/").last
|
||||
image.attachment = File.new(file_fixture("clippy.#{extension}"))
|
||||
image.attachment = fixture_file_upload("clippy.#{extension}")
|
||||
|
||||
expect(image).to be_valid
|
||||
end
|
||||
@@ -30,7 +30,7 @@ shared_examples "image validations" do |imageable_factory|
|
||||
it "is not valid for png and gif image content types" do
|
||||
["gif", "png"].each do |content_type|
|
||||
extension = content_type.split("/").last
|
||||
image.attachment = File.new(file_fixture("clippy.#{extension}"))
|
||||
image.attachment = fixture_file_upload("clippy.#{extension}")
|
||||
|
||||
expect(image).not_to be_valid
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user