asxpio/test/test_helper.rb
Sergei Poljanski bdb3682e18
Some checks failed
Tests / test (push) Successful in 18s
Build and Deploy to Production / test (push) Successful in 18s
Build and Deploy to Production / build (push) Failing after 2s
Build and Deploy to Production / deploy (push) Has been skipped
bingo: serve datacenter bingo on bingo.asxp.io
Add a second public site to the same process: a 5x5 card of the 25
largest Russian datacenters where a cell is crossed out once an incident
with a public source is recorded (Yandex Sasovo and Kaluga drone strikes
on 2026-10-08/09 are seeded). config.ru dispatches by Host, so it rides
the existing container, DB and bucket instead of a new deploy.

The card is localized ru/en/uk with per-locale columns falling back to
ru. Content is managed from /admin/bingo on asxp.io, reusing AdminAuth
and CSRF. Photos go to the existing bucket under bingo/ and are proxied
by the app, so the bucket stays private and storage needs no change.

The seed data was fact-checked against operator sites and press on
2026-10-10; several entries in the original list were wrong or vague.

Assisted-by: Claude:opus-5
2026-10-10 04:51:26 +04:00

44 lines
1.4 KiB
Ruby

ENV['RACK_ENV'] = 'test'
# Dummy env so the app class loads; nothing here reaches a real service.
ENV['SESSION_SECRET'] ||= 'test-secret-0000000000000000000000000000000000000000000000000000'
ENV['SMTP_ADDR'] ||= 'localhost'
ENV['SMTP_PORT'] ||= '587'
ENV['SMTP_USER'] ||= 'test'
ENV['SMTP_PASSWORD'] ||= 'test'
ENV['MAIL_FROM'] ||= 'Test <test@example.com>'
ENV['MAIL_TO'] ||= 'owner@example.com'
ENV['ADMIN_USER'] ||= 'admin'
ENV['ADMIN_PASSWORD'] ||= 'test-password'
# DB-backed tests run only against an explicit test database (bin/test
# provisions an ephemeral one). Never fall through to a developer DATABASE_URL.
if ENV['TEST_DATABASE_URL']
ENV['DATABASE_URL'] = ENV['TEST_DATABASE_URL']
ENV['S3_ENDPOINT'] ||= 'http://127.0.0.1:1'
ENV['S3_PUBLIC_ENDPOINT'] ||= 'http://127.0.0.1:1'
ENV['S3_ACCESS_KEY'] ||= 'test'
ENV['S3_SECRET_KEY'] ||= 'test'
ENV['S3_BUCKET'] ||= 'test-bucket'
require 'aws-sdk-s3'
Aws.config[:s3] = { stub_responses: true } # no S3 call leaves the process
else
ENV.delete('DATABASE_URL')
end
require_relative '../asxpio'
require_relative '../bingo_web'
require 'minitest/autorun'
require 'rack/test'
Mail.defaults { delivery_method :test }
module TestDb
def self.available?
!ENV['DATABASE_URL'].nil?
end
def self.clean!
DB.connection[:invoices].delete
end
end