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:
@@ -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
|
||||
Reference in New Issue
Block a user