wip: Kaminari pagination

This commit is contained in:
Kevin BATAILLE
2025-08-26 02:57:17 +02:00
parent a43c47a5db
commit 6b37c67b47
5 changed files with 59 additions and 14 deletions

View File

@@ -29,7 +29,7 @@ class PartyTest < ActiveSupport::TestCase
test "should not save party without latitude" do
party = Party.new(
name: "Valid Party Name",
name: "Valid Party Name",
description: "Valid description for the party that is long enough",
longitude: 2.3522
)
@@ -38,7 +38,7 @@ class PartyTest < ActiveSupport::TestCase
test "should not save party without longitude" do
party = Party.new(
name: "Valid Party Name",
name: "Valid Party Name",
description: "Valid description for the party that is long enough",
latitude: 48.8566
)
@@ -47,7 +47,7 @@ class PartyTest < ActiveSupport::TestCase
test "should not save party with invalid latitude" do
party = Party.new(
name: "Valid Party Name",
name: "Valid Party Name",
description: "Valid description for the party that is long enough",
latitude: 95.0,
longitude: 2.3522,
@@ -59,7 +59,7 @@ class PartyTest < ActiveSupport::TestCase
test "should not save party with invalid longitude" do
party = Party.new(
name: "Valid Party Name",
name: "Valid Party Name",
description: "Valid description for the party that is long enough",
latitude: 48.8566,
longitude: 190.0,
@@ -71,7 +71,7 @@ class PartyTest < ActiveSupport::TestCase
test "should not save party without slug" do
party = Party.new(
name: "Valid Party Name",
name: "Valid Party Name",
description: "Valid description for the party that is long enough",
latitude: 48.8566,
longitude: 2.3522,
@@ -83,7 +83,7 @@ class PartyTest < ActiveSupport::TestCase
test "should not save party with slug less than 3 characters" do
party = Party.new(
name: "Valid Party Name",
name: "Valid Party Name",
description: "Valid description for the party that is long enough",
latitude: 48.8566,
longitude: 2.3522,
@@ -94,6 +94,26 @@ class PartyTest < ActiveSupport::TestCase
assert_not party.save
end
test "should save valid party" do
user = User.create!(
email: "test@example.com",
password: "password123",
password_confirmation: "password123"
)
party = Party.new(
name: "Valid Party Name",
slug: "valid-party-name",
description: "Valid description for the party that is long enough",
latitude: 48.8566,
longitude: 2.3522,
venue_name: "Test Venue",
venue_address: "123 Test Street",
user: user,
)
assert party.save
end
# Test enum states
test "should have valid states" do
assert_equal %w[draft published canceled sold_out], Party.states.keys
@@ -101,7 +121,7 @@ class PartyTest < ActiveSupport::TestCase
test "should default to draft state" do
party = Party.new(
name: "Valid Party Name",
name: "Valid Party Name",
description: "Valid description for the party that is long enough",
latitude: 48.8566,
longitude: 2.3522,
@@ -128,7 +148,7 @@ class PartyTest < ActiveSupport::TestCase
assert_equal :ticket_types, association.options[:through]
end
# Test scopes - using class methods directly to avoid DB connection issues
# Test scopes
test "should respond to featured scope" do
assert_respond_to Party, :featured
end
@@ -140,4 +160,4 @@ class PartyTest < ActiveSupport::TestCase
test "should respond to search_by_name scope" do
assert_respond_to Party, :search_by_name
end
end
end