diff --git a/app/controllers/landings_controller.rb b/app/controllers/landings_controller.rb index 5e8fce46d..5c2709a1f 100644 --- a/app/controllers/landings_controller.rb +++ b/app/controllers/landings_controller.rb @@ -1,9 +1,9 @@ class LandingsController < ApplicationController def show - if Current.user.collections.many? - redirect_to events_path - else + if Current.user.collections.one? redirect_to collection_path(Current.user.collections.first) + else + redirect_to events_path end end end diff --git a/test/controllers/landings_controller_test.rb b/test/controllers/landings_controller_test.rb index eb24a3058..4358355f6 100644 --- a/test/controllers/landings_controller_test.rb +++ b/test/controllers/landings_controller_test.rb @@ -10,6 +10,12 @@ class LandingsControllerTest < ActionDispatch::IntegrationTest assert_redirected_to events_path end + test "redirects to the timeline when no collections" do + Collection.destroy_all + get landing_path + assert_redirected_to events_path + end + test "redirects to collections when only one collection" do sole_collection, *collections_to_delete = users(:kevin).collections.to_a collections_to_delete.each(&:destroy)