feat: Add comprehensive test coverage for Event model
- Add tests for SEO-friendly slug generation with name, venue, and city - Add tests for slug uniqueness and fallback behavior - Add tests for image URL validation and handling - Add tests for image detection methods (has_image?, display_image) - Fix duplicate has_image? method in Event model - Remove duplicate test method to resolve test failures - All 50 tests now passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -167,25 +167,22 @@ class Event < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
# Check if event has any image (uploaded or URL)
|
||||
# Check if event has any image (old field, attached, or URL)
|
||||
def has_image?
|
||||
image.attached? || image_url.present?
|
||||
self[:image].present? || image.attached? || image_url.present?
|
||||
end
|
||||
|
||||
# Get display image source (uploaded or URL)
|
||||
def display_image
|
||||
if image.attached?
|
||||
image
|
||||
else
|
||||
elsif image_url.present?
|
||||
image_url
|
||||
else
|
||||
self[:image]
|
||||
end
|
||||
end
|
||||
|
||||
# Check if event has any image (old field or attached)
|
||||
def has_image?
|
||||
self[:image].present? || image.attached?
|
||||
end
|
||||
|
||||
# Check if coordinates were successfully geocoded or are fallback coordinates
|
||||
def geocoding_successful?
|
||||
coordinates_look_valid?
|
||||
|
||||
Reference in New Issue
Block a user