From 6556f56292286291e1a853e9bf63a50872e62160 Mon Sep 17 00:00:00 2001 From: Ivan Kocienski Date: Thu, 19 May 2022 10:31:46 +0100 Subject: [PATCH] Saving calendar import mode on admin page (#1253) A small fix --- app/controllers/admin/calendars_controller.rb | 2 +- .../admin/calendars_integration_test.rb | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/calendars_controller.rb b/app/controllers/admin/calendars_controller.rb index d07f04fc5..c30239025 100644 --- a/app/controllers/admin/calendars_controller.rb +++ b/app/controllers/admin/calendars_controller.rb @@ -114,7 +114,7 @@ def calendar_params :place_id, :is_facebook_page, :facebook_page_id, - :is_working, + :importer_mode, :public_contact_name, :public_contact_phone, :public_contact_email, diff --git a/test/integration/admin/calendars_integration_test.rb b/test/integration/admin/calendars_integration_test.rb index 7be343e91..5570b1b8b 100644 --- a/test/integration/admin/calendars_integration_test.rb +++ b/test/integration/admin/calendars_integration_test.rb @@ -119,4 +119,26 @@ class Admin::CalendarsTest < ActionDispatch::IntegrationTest assert_select 'option', @partner.name, count: 1 end + + test "partner : can see which importer is selected" do + @calendar.update! importer_mode: 'ical' + + sign_in @partner_admin + get edit_admin_calendar_path(@calendar) + + assert_select 'option[value="ical"][selected="selected"]', nil, count: 1 + end + + test "partner : can change importer" do + sign_in @partner_admin + + params = { calendar: @calendar.attributes } + params[:calendar]['importer_mode'] = 'eventbrite' + + put admin_calendar_path(@calendar), params: params + + @calendar.reload + assert_equal 'eventbrite', @calendar.importer_mode + end + end