Files
MatchLiveTv/backend/spec/models/billing/invoice_spec.rb
Emiliano Frascaro 52cfffb83f Aggiunge monitoraggio ops: health check, log scanner, dashboard e notifiche.
Introduce incidenti con dedup, job Sidekiq ogni 3 min, scan log cron, /up/deep,
dashboard /admin/ops e push ntfy; include Sentry opzionale e fix test suite.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 08:16:47 +02:00

28 lines
768 B
Ruby

require "rails_helper"
RSpec.describe Billing::Invoice do
let(:club) { Club.create!(name: "Invoice Club", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff") }
it "richiede PDF per fatture emesse" do
invoice = club.billing_invoices.build(
number: "2026/001",
issued_on: Date.current,
amount_cents: 4000,
status: "issued"
)
expect(invoice.valid?(:issue)).to be(false)
expect(invoice.errors[:pdf]).to be_present
end
it "accetta bozza senza PDF" do
invoice = club.billing_invoices.create!(
number: "2026/002",
issued_on: Date.current,
amount_cents: 4000,
status: "draft"
)
expect(invoice).to be_persisted
expect(invoice.downloadable?).to be false
end
end