Replace variable values with fixed values in Swagger doc

This commit is contained in:
Maikel Linke
2023-11-08 17:12:42 +11:00
parent f76bdf0c6f
commit d0dd6e57ca
3 changed files with 16 additions and 3 deletions

View File

@@ -59,6 +59,12 @@ describe "Enterprises", type: :request, swagger_doc: "dfc.yaml", rswag_autodoc:
expect(json_response["@graph"][0]).to include(
"dfc-b:affiliates" => "http://test.host/api/dfc/enterprise_groups/60000",
)
# Insert static value to keep documentation deterministic:
response.body.gsub!(
%r{active_storage/[0-9A-Za-z/=-]*/logo-white.png},
"active_storage/url/logo-white.png",
)
end
end
end

View File

@@ -117,6 +117,7 @@ describe "SuppliedProducts", type: :request, swagger_doc: "dfc.yaml", rswag_auto
expect(second_variant.unit_value).to eq 6
# Insert static value to keep documentation deterministic:
supplied_product[:'ofn:spree_product_id'] = 90_000
response.body.gsub!(
"supplied_products/#{variant_id}",
"supplied_products/10001"
@@ -146,6 +147,12 @@ describe "SuppliedProducts", type: :request, swagger_doc: "dfc.yaml", rswag_auto
expect(response.body).to include variant.name
expect(json_response["ofn:spree_product_id"]).to eq 90_000
expect(json_response["ofn:image"]).to include("logo-white.png")
# Insert static value to keep documentation deterministic:
response.body.gsub!(
%r{active_storage/[0-9A-Za-z/=-]*/logo-white.png},
"active_storage/url/logo-white.png",
)
end
end

View File

@@ -343,7 +343,7 @@ paths:
dfc-b:usageOrStorageCondition: ''
dfc-b:totalTheoreticalStock: 0.0
ofn:spree_product_id: 90000
ofn:image: http://test.host/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBZzBCIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--cec5b9e04720cada9134f6757e3dd8156aeccbf0/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFId2FRSHciLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--a8632e6a563a139dfae774530b275266f6aef5f5/logo-white.png
ofn:image: http://test.host/rails/active_storage/url/logo-white.png
- "@id": http://test.host/api/dfc/enterprises/10000/catalog_items/10001
"@type": dfc-b:CatalogItem
dfc-b:references: http://test.host/api/dfc/enterprises/10000/supplied_products/10001
@@ -437,7 +437,7 @@ paths:
dfc-b:lifetime: ''
dfc-b:usageOrStorageCondition: ''
dfc-b:totalTheoreticalStock: 0.0
ofn:spree_product_id: 33774
ofn:spree_product_id: 90000
"/api/dfc/enterprises/{enterprise_id}/supplied_products/{id}":
parameters:
- name: enterprise_id
@@ -477,7 +477,7 @@ paths:
dfc-b:usageOrStorageCondition: ''
dfc-b:totalTheoreticalStock: 0.0
ofn:spree_product_id: 90000
ofn:image: http://test.host/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBaElCIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--f578e58da95a3e1f6a4774dfeef31ac7cb039f0f/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVFId2FRSHciLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--a8632e6a563a139dfae774530b275266f6aef5f5/logo-white.png
ofn:image: http://test.host/rails/active_storage/url/logo-white.png
'404':
description: not found
put: