kbe 24a4560634 Fix comprehensive test suite with major improvements
🧪 **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>
2025-09-05 13:51:28 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-09-03 01:52:48 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00
2025-08-28 14:27:06 +02:00

Aperonight - Event Booking Platform

Aperonight Screenshot

🌃 Overview

Aperonight is a comprehensive ticket selling system that connects event-goers with event organizers. The platform provides a complete solution for event booking, payment processing, and ticket management.

🎯 Key Features

For Event-Goers

User Dashboard - Personalized metrics showing booked events, upcoming events, and event statistics Event Discovery - Browse upcoming events with detailed information and venue details Secure Booking - Multiple ticket types per event with quantity selection Stripe Integration - Secure payment processing with credit/debit cards PDF Tickets - Automatically generated tickets with unique QR codes for each purchase Download System - Instant PDF ticket downloads after successful payment

For Event Organizers

Event Management - Create and manage events with detailed information Ticket Type Configuration - Set up multiple ticket types with different pricing Sales Tracking - Monitor ticket sales and availability User Authentication - Secure user registration and login system

Technical Implementation

Payment Processing - Full Stripe Checkout integration with session management PDF Generation - Custom PDF tickets with QR codes using Prawn library Responsive Design - Mobile-friendly interface with Tailwind CSS Database Relations - Proper user-event-ticket relationships

🛠 Technical Stack

Backend

  • Ruby on Rails 8.0+ with Hotwire for reactive UI
  • MySQL database with comprehensive migrations
  • Devise for user authentication and session management
  • Kaminari for pagination

Frontend

  • Hotwire (Turbo + Stimulus) for interactive JavaScript behavior
  • Tailwind CSS for responsive styling and modern UI
  • JavaScript Controllers for cart management and checkout flow

Key Integrations

  • Stripe for secure payment processing and checkout sessions
  • Prawn & Prawn-QRCode for PDF ticket generation
  • RQRCode for unique QR code generation per ticket

📊 Database Schema

erDiagram
    USER ||--o{ EVENT : creates
    USER ||--o{ TICKET : purchases
    USER {
        integer id
        string email
        string encrypted_password
        string first_name
        string last_name
    }
    EVENT ||--o{ TICKET_TYPE : has
    EVENT {
        integer id
        integer user_id
        string name
        string slug
        text description
        string venue_name
        string venue_address
        decimal latitude
        decimal longitude
        datetime start_time
        datetime end_time
        string state
        boolean featured
        string image
    }
    TICKET_TYPE ||--o{ TICKET : defines
    TICKET_TYPE {
        integer id
        integer event_id
        string name
        text description
        integer price_cents
        integer quantity
        datetime sale_start_at
        datetime sale_end_at
        boolean requires_id
        integer minimum_age
    }
    TICKET {
        integer id
        integer user_id
        integer ticket_type_id
        string qr_code
        integer price_cents
        string status
    }

🚀 Getting Started

Prerequisites

  • Ruby 3.4+
  • Rails 8.0+
  • MySQL/MariaDB
  • Node.js 18+ (for asset compilation)
  • Stripe account (for payment processing)

Installation

  1. Clone the repository
git clone https://github.com/yourusername/aperonight.git
cd aperonight
  1. Install dependencies
bundle install
npm install
  1. Database setup
rails db:create
rails db:migrate
rails db:seed
  1. Configure environment variables Create a .env file or configure Rails credentials:
# Stripe configuration
STRIPE_PUBLISHABLE_KEY=pk_test_your_key_here
STRIPE_SECRET_KEY=sk_test_your_key_here
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here

# Database configuration (if not using defaults)
DATABASE_URL=mysql2://username:password@localhost/aperonight_development
  1. Start the development server
rails server

Visit http://localhost:3000 to see the application running.

💳 Payment Configuration

Setting up Stripe

  1. Create a Stripe account at stripe.com
  2. Get your API keys from the Stripe Dashboard
  3. Add your keys to the Rails credentials or environment variables
  4. Configure webhook endpoints for payment confirmations:
    • Endpoint URL: your-domain.com/stripe/webhooks
    • Events: checkout.session.completed, payment_intent.succeeded

🎫 Core Functionality

User Flow

  1. Registration/Login - Users create accounts or sign in
  2. Event Discovery - Browse events from the homepage or events page
  3. Ticket Selection - Choose ticket types and quantities
  4. Checkout - Secure payment through Stripe Checkout
  5. Ticket Generation - Automatic PDF ticket generation with QR codes
  6. Download - Instant ticket download after payment

Event Management

  1. Event Creation - Create events with full details and images
  2. Ticket Types - Configure multiple ticket types with pricing
  3. Sales Tracking - Monitor ticket sales through the dashboard

Dashboard Features

  • Personal Metrics - View booked events and upcoming events
  • Event Sections - Today's events, tomorrow's events, and upcoming events
  • Quick Actions - Easy navigation to event discovery and booking

🔧 Development

Key Files Structure

app/
├── controllers/
│   ├── events_controller.rb      # Event listing, booking, checkout
│   └── pages_controller.rb       # Dashboard and static pages
├── models/
│   ├── user.rb                   # User authentication with Devise
│   ├── event.rb                  # Event management and states
│   ├── ticket_type.rb            # Ticket configuration
│   └── ticket.rb                 # Ticket generation with QR codes
├── services/
│   └── ticket_pdf_generator.rb   # PDF ticket generation service
└── views/
    ├── events/
    │   ├── show.html.erb          # Event details and booking
    │   └── payment_success.html.erb # Post-purchase confirmation
    └── pages/
        └── dashboard.html.erb     # User dashboard with metrics

Key Routes

  • GET / - Homepage
  • GET /dashboard - User dashboard (authenticated)
  • GET /events - Event listings
  • GET /events/:slug.:id - Event details and booking
  • POST /events/:slug.:id/checkout - Stripe checkout initiation
  • GET /payment/success - Payment confirmation
  • GET /tickets/:ticket_id/download - PDF ticket download
Description
No description provided
Readme 4.7 MiB
Languages
HTML 49.6%
Ruby 34.8%
CSS 8.8%
JavaScript 6%
Dockerfile 0.4%
Other 0.4%