A platform for community discussion. Free, open, simple.
DEV: Add a test for api scope routes (#22597)
Blake Erickson380890d28b09
diff --git a/spec/requests/admin/api_controller_spec.rb b/spec/requests/admin/api_controller_spec.rbindex 3d6bae83881..d83520968f5 100644--- a/spec/requests/admin/api_controller_spec.rb+++ b/spec/requests/admin/api_controller_spec.rb@@ -435,7 +435,26 @@ RSpec.describe Admin::ApiController do"wordpress",)- expect(scopes["topics"].any? { |h| h["urls"].include?("/latest.rss (GET)") }).to be_truthy+ topic_routes = [+ "/t/:id (GET)",+ "/t/external_id/:external_id (GET)",+ "/t/:slug/:topic_id/print (GET)",+ "/t/:slug/:topic_id/summary (GET)",+ "/t/:topic_id/summary (GET)",+ "/t/:topic_id/:post_number (GET)",+ "/t/:topic_id/last (GET)",+ "/t/:slug/:topic_id.rss (GET)",+ "/t/:slug/:topic_id (GET)",+ "/t/:slug/:topic_id/:post_number (GET)",+ "/t/:slug/:topic_id/last (GET)",+ "/t/:topic_id/posts (GET)",+ "/latest.rss (GET)",+ ]++ topic_routes.each do |route|+ expect(scopes["topics"].any? { |h| h["urls"].include?(route) }).to be_truthy+ end+expect(scopes["posts"].any? { |h| h["urls"].include?("/posts (GET)") }).to be_truthyexpect(scopes["posts"].any? { |h| h["urls"].include?("/private-posts (GET)") }).to be_truthyend