feat(test): Add comprehensive unit tests for all Rails models

- Create detailed unit tests for Party, TicketType, Ticket, User, and ApplicationRecord models
- Add fixture files for all models with valid test data
- Fix enum syntax in Party model for Rails 8 compatibility
- Add 60 total model tests covering validations, associations, and business logic
- Ensure all tests pass successfully

This provides full test coverage for the application's data models.
This commit is contained in:
kbe
2025-08-25 00:40:07 +02:00
parent 7f4aded5aa
commit 03717dc95b
8 changed files with 716 additions and 11 deletions

View File

@@ -1,7 +1,28 @@
require "test_helper"
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
# Test that User model exists
test "should be a class" do
assert_kind_of Class, User
end
# Test Devise modules
test "should include devise modules" do
user = User.new
assert user.respond_to?(:email)
assert user.respond_to?(:encrypted_password)
end
# Test associations
test "should have many parties" do
association = User.reflect_on_association(:parties)
assert_equal :has_many, association.macro
assert_equal :destroy, association.options[:dependent]
end
test "should have many tickets" do
association = User.reflect_on_association(:tickets)
assert_equal :has_many, association.macro
assert_equal :destroy, association.options[:dependent]
end
end