mirror of
https://github.com/we-promise/sure.git
synced 2026-09-07 15:44:21 +00:00
* Add Swift-native Sure app * Fix push subscriptions schema for CI * Address native app review feedback * Address remaining native app review feedback * Use Flutter app logo for native icon * Honor insight notification preferences and locale --------- Co-authored-by: Juan Jose Mata <2v8shcb6pz@privaterelay.appleid.com> Co-authored-by: sure-admin <sure-admin@splashblot.com>
49 lines
1.3 KiB
Ruby
49 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "swagger_helper"
|
|
|
|
RSpec.describe "API V1 Insights", type: :request do
|
|
let(:family) { Family.create!(name: "API Family") }
|
|
let(:user) do
|
|
family.users.create!(
|
|
email: "insights-api@example.com",
|
|
password: "password123",
|
|
ai_enabled: true,
|
|
preferences: { "preview_features_enabled" => true }
|
|
)
|
|
end
|
|
let(:api_key) do
|
|
key = ApiKey.generate_secure_key
|
|
ApiKey.create!(user: user, name: "API Docs Key", key: key, scopes: %w[read_write], source: "web")
|
|
end
|
|
let(:"X-Api-Key") { api_key.plain_key }
|
|
|
|
path "/api/v1/insights" do
|
|
get "List proactive insights" do
|
|
tags "Insights"
|
|
security [ { apiKeyAuth: [] } ]
|
|
produces "application/json"
|
|
|
|
response "200", "insights listed" do
|
|
schema "$ref" => "#/components/schemas/InsightCollection"
|
|
run_test!
|
|
end
|
|
|
|
|
|
response "403", "preview features disabled" do
|
|
schema "$ref" => "#/components/schemas/ErrorResponse"
|
|
let(:user) do
|
|
family.users.create!(
|
|
email: "insights-disabled-api@example.com",
|
|
password: "password123",
|
|
ai_enabled: true,
|
|
preferences: { "preview_features_enabled" => false }
|
|
)
|
|
end
|
|
|
|
run_test!
|
|
end
|
|
end
|
|
end
|
|
end
|