Skip to content

Uploading file ActiveStorage #16

@ShonRepo

Description

@ShonRepo

Hey!
If I upload a file using the as: :json post method, I get this error

ArgumentError: missing keywords: :io, :filename

but, not use as: :json, the file is loading successfully, but if there is a body required parameter in the openapi schema, then I get the error body id required

code:

    describe "POST" do
      let_it_be(:test_file) { file_fixture("image.jpeg") }
      let_it_be(:file_upload) { fixture_file_upload(test_file, "image/jpeg") }

      let(:body) do
        {
          ...
          image: file_upload
        }
      end

      subject { post "path", params: body, as: :json }

      context "success" do
        it { is_expected.to conform_schema(201) }
      end
    end
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions