Separa i canali app e mostra il nodo ingest nelle sessioni admin. Co-authored-by: Cursor <cursoragent@cursor.com>
55 lines
1.7 KiB
Ruby
55 lines
1.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "rails_helper"
|
|
|
|
RSpec.describe "Api::V1::Announcements", type: :request do
|
|
it "GET /api/v1/announcements senza autenticazione restituisce solo gli avvisi attivi per la piattaforma" do
|
|
AppAnnouncement.create!(
|
|
kind: "maintenance",
|
|
severity: "warning",
|
|
status: "published",
|
|
title: "Manutenzione stasera",
|
|
body: "Dalle 23:00 alle 01:00 il servizio sarà offline.",
|
|
show_on_android: true,
|
|
show_on_ios: true
|
|
)
|
|
AppAnnouncement.create!(
|
|
kind: "info",
|
|
status: "published",
|
|
title: "Solo sito",
|
|
body: "Non in app",
|
|
show_on_android: false,
|
|
show_on_ios: false,
|
|
show_on_web_public: true
|
|
)
|
|
AppAnnouncement.create!(
|
|
kind: "info",
|
|
status: "draft",
|
|
title: "Bozza",
|
|
body: "Non deve uscire"
|
|
)
|
|
AppAnnouncement.create!(
|
|
kind: "update",
|
|
status: "published",
|
|
title: "Aggiorna",
|
|
body: "Versione nuova",
|
|
show_on_android: true,
|
|
show_on_ios: false,
|
|
android_title: "Aggiorna Android",
|
|
android_action_url: "https://play.google.com/store/apps/details?id=com.matchlivetv.match_live_tv"
|
|
)
|
|
|
|
get "/api/v1/announcements", params: { platform: "android" }
|
|
|
|
expect(response).to have_http_status(:ok)
|
|
android_body = JSON.parse(response.body)
|
|
expect(android_body.map { |row| row["title"] }).to contain_exactly("Manutenzione stasera", "Aggiorna Android")
|
|
|
|
get "/api/v1/announcements", params: { platform: "ios" }
|
|
|
|
expect(response).to have_http_status(:ok)
|
|
ios_body = JSON.parse(response.body)
|
|
expect(ios_body.map { |row| row["title"] }).to eq(["Manutenzione stasera"])
|
|
end
|
|
end
|