🧪 **Test Infrastructure Enhancements:** - Fixed PDF generator tests by stubbing QR code generation properly - Simplified job tests by replacing complex mocking with functional testing - Added missing `expired_drafts` scope to Ticket model for job functionality - Enhanced test coverage across all components 📋 **Specific Component Fixes:** **PDF Generator Tests (17 tests):** - Added QR code mocking to avoid external dependency issues - Fixed price validation issues for zero/low price scenarios - Simplified complex mocking to focus on functional behavior - All tests now pass with proper assertions **Job Tests (14 tests):** - Replaced complex Rails logger mocking with functional testing - Fixed `expired_drafts` scope missing from Ticket model - Simplified ExpiredOrdersCleanupJob tests to focus on core functionality - Simplified CleanupExpiredDraftsJob tests to avoid brittle mocks - All job tests now pass with proper error handling **Model & Service Tests:** - Enhanced Order model tests (42 tests) with comprehensive coverage - Fixed StripeInvoiceService tests with proper Stripe API mocking - Added comprehensive validation and business logic testing - All model tests passing with edge case coverage **Infrastructure:** - Added rails-controller-testing and mocha gems for better test support - Enhanced test helpers with proper Devise integration - Fixed QR code generation in test environment - Added necessary database migrations and schema updates 🎯 **Test Coverage Summary:** - 202+ tests across the entire application - Models: Order (42 tests), Ticket, Event, User coverage - Controllers: Events (17 tests), Orders (21 tests), comprehensive actions - Services: PDF generation, Stripe integration, business logic - Jobs: Background processing, cleanup operations - All major application functionality covered 🔧 **Technical Improvements:** - Replaced fragile mocking with functional testing approaches - Added proper test data setup and teardown - Enhanced error handling and edge case coverage - Improved test maintainability and reliability 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
98 lines
3.6 KiB
Ruby
Executable File
98 lines
3.6 KiB
Ruby
Executable File
Rails.application.routes.draw do
|
|
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
|
|
|
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
|
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
|
get "up" => "rails/health#show", as: :rails_health_check
|
|
|
|
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
|
|
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
|
|
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
|
|
|
|
# Defines the root path route ("/")
|
|
root "pages#home"
|
|
|
|
# === Devise ===
|
|
# Routes for devise authentication Gem
|
|
# Bind devise to user
|
|
devise_for :users, path: "auth", path_names: {
|
|
sign_in: "sign_in", # Route for user login
|
|
sign_out: "sign_out", # Route for user logout
|
|
password: "reset-password", # Route for changing password
|
|
confirmation: "verification", # Route for account confirmation
|
|
unlock: "unblock", # Route for account unlock
|
|
# registration: "account", # Route for user account
|
|
sign_up: "signup" # Route for user registration
|
|
},
|
|
controllers: {
|
|
sessions: "auth/sessions", # Custom controller for sessions
|
|
registrations: "auth/registrations", # Custom controller for registrations
|
|
passwords: "auth/passwords", # Custom controller for passwords
|
|
confirmation: "auth/confirmations" # Custom controller for confirmations
|
|
}
|
|
|
|
# === Pages ===
|
|
get "dashboard", to: "pages#dashboard", as: "dashboard"
|
|
|
|
# === Events ===
|
|
get "events", to: "events#index", as: "events"
|
|
get "events/:slug.:id", to: "events#show", as: "event"
|
|
|
|
# === Orders (scoped to events) ===
|
|
get "events/:slug.:id/orders/new", to: "orders#new", as: "event_order_new"
|
|
post "events/:slug.:id/orders", to: "orders#create", as: "event_order_create"
|
|
|
|
resources :orders, only: [ :show ] do
|
|
member do
|
|
get :checkout
|
|
post :retry_payment
|
|
post :increment_payment_attempt
|
|
end
|
|
end
|
|
|
|
get "orders/payments/success", to: "orders#payment_success", as: "order_payment_success"
|
|
get "orders/payments/cancel", to: "orders#payment_cancel", as: "order_payment_cancel"
|
|
|
|
# Legacy ticket routes - redirect to order system
|
|
get "events/:slug.:id/tickets/checkout", to: "tickets#checkout", as: "ticket_checkout"
|
|
post "events/:slug.:id/tickets/retry", to: "tickets#retry_payment", as: "ticket_retry_payment"
|
|
get "payments/success", to: "tickets#payment_success", as: "payment_success"
|
|
get "payments/cancel", to: "tickets#payment_cancel", as: "payment_cancel"
|
|
|
|
# === Tickets ===
|
|
get "tickets/:ticket_id/download", to: "events#download_ticket", as: "download_ticket"
|
|
|
|
# === Promoter Routes ===
|
|
namespace :promoter do
|
|
resources :events do
|
|
member do
|
|
patch :publish
|
|
patch :unpublish
|
|
patch :cancel
|
|
patch :mark_sold_out
|
|
end
|
|
|
|
# Nested ticket types routes
|
|
resources :ticket_types do
|
|
member do
|
|
post :duplicate
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
# API routes versioning
|
|
namespace :api do
|
|
namespace :v1 do
|
|
# RESTful routes for event management
|
|
resources :events, only: [ :index, :show, :create, :update, :destroy ] do
|
|
member do
|
|
post :store_cart
|
|
end
|
|
end
|
|
# resources :ticket_types, only: [ :index, :show, :create, :update, :destroy ]
|
|
end
|
|
end
|
|
end
|