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:
@@ -5,7 +5,7 @@ describe Document do
|
||||
it_behaves_like "document validations", "proposal_document"
|
||||
|
||||
it "stores attachments with Active Storage" do
|
||||
document = create(:document, attachment: File.new(file_fixture("clippy.pdf")))
|
||||
document = create(:document, attachment: fixture_file_upload("clippy.pdf"))
|
||||
|
||||
expect(document.attachment).to be_attached
|
||||
expect(document.attachment.filename).to eq "clippy.pdf"
|
||||
|
||||
Reference in New Issue
Block a user