- all catalog services (update/software/highlighted/builds/file/file-manager/ download/image + SoftwareResponseBuilder), the SoftwareUpdater platform services and their concerns, Blueprinter serializers (incl. TimestampFields) and the 4 DTOs now live in the engine under WarpEngine:: - constantize dispatch strings use absolute names (WarpEngine::SoftwareUpdater::<Platform>Service) - container paths read from WarpEngine.config everywhere (FileService, DownloadService, FileManagerService, ArchiveExtraction, ReleaseSerializer path rewriting); FileManagerService base path is now lazy - engine requires blueprinter itself; gemspec declares blueprinter + rubyzip - engine test suite: spec/dummy app (mysql warp_engine_test, catalog-only schema), rails_helper with engine-local factories; catalog model/service specs and factories moved from the host - host suite keeps TTG specs and loads catalog factories from the engine Verified: engine suite 40 green, host suite 14 green, /api/software and /api/builds byte-identical to baselines, admin OK. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
60 lines
2.3 KiB
Ruby
60 lines
2.3 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe WarpEngine::UpdateService do
|
|
describe "#update" do
|
|
it "raises ArgumentError for unsupported platform" do
|
|
input = WarpEngine::UpdateInputDto.new(platform: "unknown", name: "game", version: "1.0")
|
|
|
|
expect { described_class.new.update(input) }.to raise_error(ArgumentError, /Unsupported platform/)
|
|
end
|
|
|
|
it "routes to correct platform service" do
|
|
input = WarpEngine::UpdateInputDto.new(platform: "tic80", name: "game", version: "1.0")
|
|
mock_service = instance_double(WarpEngine::SoftwareUpdater::Tic80Service)
|
|
|
|
allow(WarpEngine::SoftwareUpdater::Tic80Service).to receive(:new).and_return(mock_service)
|
|
allow(mock_service).to receive(:update)
|
|
|
|
described_class.new.update(input)
|
|
|
|
expect(mock_service).to have_received(:update).with("game", "1.0")
|
|
end
|
|
|
|
it "routes godot platform to GodotService" do
|
|
input = WarpEngine::UpdateInputDto.new(platform: "godot", name: "game", version: "1.0")
|
|
mock_service = instance_double(WarpEngine::SoftwareUpdater::GodotService)
|
|
|
|
allow(WarpEngine::SoftwareUpdater::GodotService).to receive(:new).and_return(mock_service)
|
|
allow(mock_service).to receive(:update)
|
|
|
|
described_class.new.update(input)
|
|
|
|
expect(mock_service).to have_received(:update).with("game", "1.0")
|
|
end
|
|
|
|
it "routes bevy platform to BevyService" do
|
|
input = WarpEngine::UpdateInputDto.new(platform: "bevy", name: "game", version: "1.0")
|
|
mock_service = instance_double(WarpEngine::SoftwareUpdater::BevyService)
|
|
|
|
allow(WarpEngine::SoftwareUpdater::BevyService).to receive(:new).and_return(mock_service)
|
|
allow(mock_service).to receive(:update)
|
|
|
|
described_class.new.update(input)
|
|
|
|
expect(mock_service).to have_received(:update).with("game", "1.0")
|
|
end
|
|
|
|
it "routes phaser platform to PhaserService" do
|
|
input = WarpEngine::UpdateInputDto.new(platform: "phaser", name: "game", version: "1.0")
|
|
mock_service = instance_double(WarpEngine::SoftwareUpdater::PhaserService)
|
|
|
|
allow(WarpEngine::SoftwareUpdater::PhaserService).to receive(:new).and_return(mock_service)
|
|
allow(mock_service).to receive(:update)
|
|
|
|
described_class.new.update(input)
|
|
|
|
expect(mock_service).to have_received(:update).with("game", "1.0")
|
|
end
|
|
end
|
|
end
|