- Add Active Storage migrations for file attachments - Update Event model to handle image uploads with validation - Replace image URL fields with file upload in forms - Add client-side image preview with validation - Update all views to display uploaded images properly - Fix JSON serialization to prevent stack overflow in API - Add custom image validation methods for format and size - Include image processing variants for different display sizes - Fix promotion code test infrastructure and Stripe configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
67 lines
1.7 KiB
Ruby
Executable File
67 lines
1.7 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
# Debug script to understand the test failure
|
|
require_relative './config/environment'
|
|
|
|
# Load test data
|
|
user = User.find_by(email: 'user1@example.com')
|
|
event = Event.find_by(name: 'Summer Concert')
|
|
order = Order.find_by(status: 'draft')
|
|
|
|
puts "User: #{user.inspect}"
|
|
puts "Event: #{event.inspect}"
|
|
puts "Order: #{order.inspect}"
|
|
|
|
# Check if the user can manage events
|
|
puts "User can manage events: #{user.can_manage_events?}"
|
|
|
|
# Create a promotion code
|
|
promotion_code = PromotionCode.create(
|
|
code: "TESTDISCOUNT",
|
|
discount_amount_cents: 500,
|
|
expires_at: 1.month.from_now,
|
|
active: true,
|
|
user: user,
|
|
event: event
|
|
)
|
|
|
|
puts "Promotion code: #{promotion_code.inspect}"
|
|
puts "Promotion code valid?: #{promotion_code.valid_for_use?}"
|
|
|
|
# Try to create a ticket type and ticket
|
|
ticket_type = TicketType.create!(
|
|
name: "Test Ticket Type",
|
|
description: "A valid description for the ticket type that is long enough",
|
|
price_cents: 2000,
|
|
quantity: 10,
|
|
sale_start_at: Time.current,
|
|
sale_end_at: Time.current + 1.day,
|
|
requires_id: false,
|
|
event: event
|
|
)
|
|
|
|
puts "Ticket type: #{ticket_type.inspect}"
|
|
|
|
# Create ticket with all required fields
|
|
ticket = Ticket.create!(
|
|
order: order,
|
|
ticket_type: ticket_type,
|
|
status: "draft",
|
|
first_name: "John",
|
|
last_name: "Doe",
|
|
price_cents: 2000
|
|
)
|
|
|
|
puts "Ticket: #{ticket.inspect}"
|
|
puts "Ticket valid?: #{ticket.valid?}"
|
|
puts "Ticket errors: #{ticket.errors.full_messages}" unless ticket.valid?
|
|
|
|
# Recalculate order total
|
|
order.calculate_total!
|
|
puts "Order total: #{order.total_amount_cents}"
|
|
|
|
# Test the promotion code application
|
|
puts "Applying promotion code..."
|
|
order.promotion_codes << promotion_code
|
|
order.calculate_total!
|
|
puts "Order total after promotion: #{order.total_amount_cents}" |