Module: Minitest::OpenAPI::DSL

Defined in:
lib/minitest/openapi/dsl.rb

Overview

Helper-method DSL for classic class-based integration tests:

class MediaEntriesApiTest < ActionDispatch::IntegrationTest
  include Minitest::OpenAPI::DSL

  test "lists media entries" do
    openapi_get "/api/v1/media_entries",
      summary: "List media entries",
      response: {status: 200, schema: {"$ref" => "#/components/schemas/MediaEntry"}}
    assert_response :success
  end
end

Each openapi_<verb> performs the request, validates the response body against the declared schema, records the operation, and returns the response so further assertions can be made.