Skip to content

How should we be testing mutations that accept uploaded files in 2.1.5? #61

@Haegin

Description

@Haegin

I'm in the process of upgrading an app from 2.0.1 to 2.1.5 and all the tests we have involving uploaded files are now failing with an "#Rack::Test::UploadedFiles... is not a valid upload" error. In our tests we're creating these files using a helper method:

module UploadTestHelper
  def generic_file
    Rack::Test::UploadedFile.new(Rails.root.join("spec", "data", "test_attachment.txt"))
  end
end

and then we're using it anywhere we need a file in the tests:

let(:variables) do
  {
    input: {
      quoteId: quote.id,
      files: [UploadTestHelper.quote],
    }
  }
end

This was working as expected until now, but after upgrading to 2.1.5 these test files are being rejected. I can't see any documentation on how to create test files. I've tracked down the issue to this change - https://github.com/jetruby/apollo_upload_server-ruby/pull/32/files. Is it possible to get an example of how to use this Wrappers::UploadedFile class to wrap up a local file for specs please? I've tried a few things and haven't managed to get anything working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions