discourse/spec/requests/api/site_spec.rb
Jarek Radosz fbb3bf3fe8
DEV: Enable Style/RedundantBegin rubocop rule (#40096)
(to be enabled in the shared config)

best reviewed with whitespace disabled
2026-05-19 18:44:54 +02:00

59 lines
1.7 KiB
Ruby
Vendored

# frozen_string_literal: true
require "swagger_helper"
RSpec.describe "site" do
fab!(:admin)
fab!(:category)
fab!(:subcategory) { Fabricate(:category, parent_category: category) }
before do
Jobs.run_immediately!
sign_in(admin)
end
path "/site.json" do
get "Get site info" do
tags "Site", "Categories"
operationId "getSite"
description "Can be used to fetch all categories and subcategories"
consumes "application/json"
expected_request_schema = nil
produces "application/json"
response "200", "success response" do
Site.preloaded_category_custom_fields << "no_oddjob"
expected_response_schema = load_spec_schema("site_response")
schema expected_response_schema
it_behaves_like "a JSON endpoint", 200 do
let(:expected_response_schema) { expected_response_schema }
let(:expected_request_schema) { expected_request_schema }
end
ensure
Site.reset_preloaded_category_custom_fields
end
end
end
path "/site/basic-info.json" do
get "Get site basic info" do
tags "Site"
operationId "getSiteBasicInfo"
description "Can be used to fetch basic info about a site"
consumes "application/json"
expected_request_schema = nil
produces "application/json"
response "200", "success response" do
expected_response_schema = load_spec_schema("site_basic_info_response")
schema expected_response_schema
it_behaves_like "a JSON endpoint", 200 do
let(:expected_response_schema) { expected_response_schema }
let(:expected_request_schema) { expected_request_schema }
end
end
end
end
end