Aggiunge annunci in-app/sito, contatti e migliora UI copertina sul portale.
Include admin/API/banner nativi, form contatti e reset copertina standard con layout edit più ampio. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe "Admin announcements", type: :request do
|
||||
let!(:admin) { AdminAccount.create!(username: "ops-news", password: "Password123") }
|
||||
|
||||
before do
|
||||
post admin_login_path, params: { username: "ops-news", password: "Password123" }
|
||||
end
|
||||
|
||||
it "crea e pubblica un avviso visibile alle app e al sito" do
|
||||
post admin_announcements_path, params: {
|
||||
app_announcement: {
|
||||
kind: "update",
|
||||
severity: "info",
|
||||
status: "published",
|
||||
title: "Nuova versione",
|
||||
body: "Aggiorna l'app dallo store.",
|
||||
dismissible: "1",
|
||||
show_on_app: "1",
|
||||
show_on_web_public: "1",
|
||||
show_on_web_private: "0"
|
||||
}
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(admin_announcements_path)
|
||||
notice = AppAnnouncement.last
|
||||
expect(notice.title).to eq("Nuova versione")
|
||||
expect(notice).to be_published
|
||||
expect(notice.show_on_app).to be(true)
|
||||
expect(notice.show_on_web_public).to be(true)
|
||||
expect(notice.show_on_web_private).to be(false)
|
||||
|
||||
get admin_announcements_path
|
||||
expect(response.body).to include("Nuova versione")
|
||||
expect(response.body).to include(I18n.t("admin.announcements.channels.web_public"))
|
||||
end
|
||||
|
||||
it "elimina un avviso" do
|
||||
item = AppAnnouncement.create!(
|
||||
kind: "info", status: "published", title: "Da togliere", body: "Test"
|
||||
)
|
||||
|
||||
delete admin_announcement_path(item)
|
||||
|
||||
expect(response).to redirect_to(admin_announcements_path)
|
||||
expect(AppAnnouncement.find_by(id: item.id)).to be_nil
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user