Fix swagger-api integration after last update

See also:

* https://github.com/rswag/rswag/pull/668
This commit is contained in:
Maikel Linke
2023-07-26 15:52:48 +10:00
parent a832562d1f
commit 627e689757
2 changed files with 21 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ Rswag::Api.configure do |config|
# This is used by the Swagger middleware to serve requests for API descriptions
# NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure
# that it's configured to generate files in the same folder
config.swagger_root = Rails.root.join("swagger")
config.swagger_root = Rails.root.join("swagger").to_s
# Inject a lamda function to alter the returned Swagger prior to serialization
# The function will have access to the rack env for the current request

View File

@@ -0,0 +1,20 @@
# frozen_string_literal: true
require 'spec_helper'
describe "API documentation", type: :request do
it "shows the OFN API v1" do
get rswag_ui_path
expect(response).to redirect_to "/api-docs/index.html"
get "/api-docs/index.html"
expect(response).to have_http_status :success
expect(response.body).to match "API V1"
end
it "can load the Swagger config" do
get "/api-docs/v1/swagger.yaml"
expect(response).to have_http_status :success
end
end