- 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.
28 lines
776 B
Ruby
28 lines
776 B
Ruby
require "test_helper"
|
|
|
|
class UserTest < ActiveSupport::TestCase
|
|
# 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 |