+
+ <%= render 'components/breadcrumb', crumbs: [
+ { name: 'Dashboard', path: dashboard_path },
+ { name: 'Événements', path: promoter_events_path },
+ { name: @event.name, path: promoter_event_path(@event) },
+ { name: 'Types de billets', path: promoter_event_ticket_types_path(@event) },
+ { name: @ticket_type.name, path: nil }
+ ] %>
+
diff --git a/test/controllers/promoter/events_controller_test.rb b/test/controllers/promoter/events_controller_test.rb
index 512a214..1bf2f01 100644
--- a/test/controllers/promoter/events_controller_test.rb
+++ b/test/controllers/promoter/events_controller_test.rb
@@ -28,7 +28,7 @@ class Promoter::EventsControllerTest < ActionDispatch::IntegrationTest
test "should duplicate an event with ticket types" do
sign_in @promoter
-
+
# Create ticket types for the event
ticket_type1 = TicketType.create!(
name: "Standard Ticket",
@@ -39,7 +39,7 @@ class Promoter::EventsControllerTest < ActionDispatch::IntegrationTest
sale_end_at: @event.start_time - 1.hour,
event: @event
)
-
+
ticket_type2 = TicketType.create!(
name: "VIP Ticket",
description: "A VIP ticket for the event with special access",
@@ -49,27 +49,27 @@ class Promoter::EventsControllerTest < ActionDispatch::IntegrationTest
sale_end_at: @event.start_time - 1.hour,
event: @event
)
-
+
# Verify that ticket types were created successfully
assert ticket_type1.valid?
assert ticket_type2.valid?
-
+
# Duplicate the event
- assert_difference('Event.count', 1) do
+ assert_difference("Event.count", 1) do
post duplicate_promoter_event_path(@event), params: { clone_ticket_types: "true" }
end
-
+
# Check that the new event was created
assert_redirected_to edit_promoter_event_path(Event.last)
assert_equal "Événement dupliqué avec succès! Vous pouvez maintenant modifier les détails de l'événement copié.", flash[:notice]
-
+
# Check that the new event has the correct attributes
new_event = Event.last
assert_equal "Copie de #{@event.name}", new_event.name
assert_equal "draft", new_event.state
assert_equal @event.venue_name, new_event.venue_name
assert_equal @event.venue_address, new_event.venue_address
-
+
# Check that ticket types were duplicated
assert_equal 2, new_event.ticket_types.count
assert_equal "Standard Ticket", new_event.ticket_types.find_by(name: "Standard Ticket").name
@@ -78,7 +78,7 @@ class Promoter::EventsControllerTest < ActionDispatch::IntegrationTest
test "should duplicate an event without ticket types" do
sign_in @promoter
-
+
# Create ticket types for the event
ticket_type1 = TicketType.create!(
name: "Standard Ticket",
@@ -89,7 +89,7 @@ class Promoter::EventsControllerTest < ActionDispatch::IntegrationTest
sale_end_at: @event.start_time - 1.hour,
event: @event
)
-
+
ticket_type2 = TicketType.create!(
name: "VIP Ticket",
description: "A VIP ticket for the event with special access",
@@ -99,27 +99,27 @@ class Promoter::EventsControllerTest < ActionDispatch::IntegrationTest
sale_end_at: @event.start_time - 1.hour,
event: @event
)
-
+
# Verify that ticket types were created successfully
assert ticket_type1.valid?
assert ticket_type2.valid?
-
+
# Duplicate the event without ticket types
- assert_difference('Event.count', 1) do
+ assert_difference("Event.count", 1) do
post duplicate_promoter_event_path(@event), params: { clone_ticket_types: "false" }
end
-
+
# Check that the new event was created
assert_redirected_to edit_promoter_event_path(Event.last)
assert_equal "Événement dupliqué avec succès! Vous pouvez maintenant modifier les détails de l'événement copié.", flash[:notice]
-
+
# Check that the new event has the correct attributes
new_event = Event.last
assert_equal "Copie de #{@event.name}", new_event.name
assert_equal "draft", new_event.state
assert_equal @event.venue_name, new_event.venue_name
assert_equal @event.venue_address, new_event.venue_address
-
+
# Check that ticket types were NOT duplicated
assert_equal 0, new_event.ticket_types.count
end
diff --git a/test/models/event_test.rb b/test/models/event_test.rb
index 78f2e55..8249bd1 100755
--- a/test/models/event_test.rb
+++ b/test/models/event_test.rb
@@ -275,21 +275,21 @@ class EventTest < ActiveSupport::TestCase
test "should duplicate event with ticket types" do
user = User.create!(email: "test@example.com", password: "password123", password_confirmation: "password123")
event = Event.create!(name: "Original Event", slug: "original", description: "A description that is sufficiently long", venue_name: "v", venue_address: "a", user: user, latitude: 48.0, longitude: 2.0, start_time: 1.week.from_now, state: :published)
-
+
# Create ticket types
ticket_type1 = TicketType.create!(name: "Standard", description: "A standard ticket for the event", price_cents: 2000, quantity: 100, sale_start_at: 1.day.ago, sale_end_at: event.start_time - 1.hour, event: event)
ticket_type2 = TicketType.create!(name: "VIP", description: "A VIP ticket for the event", price_cents: 5000, quantity: 50, sale_start_at: 1.day.ago, sale_end_at: event.start_time - 1.hour, event: event)
-
+
# Duplicate the event
duplicated_event = event.duplicate
-
+
# Check that duplication was successful
assert_not_nil duplicated_event
assert_equal "Copie de #{event.name}", duplicated_event.name
assert_equal "draft", duplicated_event.state
assert_equal event.venue_name, duplicated_event.venue_name
assert_equal event.venue_address, duplicated_event.venue_address
-
+
# Check that ticket types were duplicated
assert_equal 2, duplicated_event.ticket_types.count
assert_equal "Standard", duplicated_event.ticket_types.find_by(name: "Standard").name
@@ -299,21 +299,21 @@ class EventTest < ActiveSupport::TestCase
test "should duplicate event without ticket types" do
user = User.create!(email: "test@example.com", password: "password123", password_confirmation: "password123")
event = Event.create!(name: "Original Event", slug: "original", description: "A description that is sufficiently long", venue_name: "v", venue_address: "a", user: user, latitude: 48.0, longitude: 2.0, start_time: 1.week.from_now, state: :published)
-
+
# Create ticket types
ticket_type1 = TicketType.create!(name: "Standard", description: "A standard ticket for the event", price_cents: 2000, quantity: 100, sale_start_at: 1.day.ago, sale_end_at: event.start_time - 1.hour, event: event)
ticket_type2 = TicketType.create!(name: "VIP", description: "A VIP ticket for the event", price_cents: 5000, quantity: 50, sale_start_at: 1.day.ago, sale_end_at: event.start_time - 1.hour, event: event)
-
+
# Duplicate the event without ticket types
duplicated_event = event.duplicate(clone_ticket_types: false)
-
+
# Check that duplication was successful
assert_not_nil duplicated_event
assert_equal "Copie de #{event.name}", duplicated_event.name
assert_equal "draft", duplicated_event.state
assert_equal event.venue_name, duplicated_event.venue_name
assert_equal event.venue_address, duplicated_event.venue_address
-
+
# Check that ticket types were NOT duplicated
assert_equal 0, duplicated_event.ticket_types.count
end