This commit is contained in:
Asish Kumar 2026-06-27 18:17:28 +02:00 committed by GitHub
commit 0c8dcc3f90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 57 additions and 6 deletions

View file

@ -26,5 +26,17 @@ describe SchedulesController do
expect(response).to be_successful
end
end
context 'when schedule is public but no events are scheduled' do
before :each do
conference.program.update!(schedule_public: true)
end
it 'returns 404 instead of rendering a broken page' do
expect do
get :show, params: { conference_id: conference.short_title }
end.to raise_error(ActionController::RoutingError)
end
end
end
end

View file

@ -283,6 +283,27 @@ describe Program do
end
end
describe '#any_published_schedule?' do
let(:event) { create(:event, program: program) }
let(:schedule) { create(:schedule, program: program) }
let!(:event_schedule) { create(:event_schedule, event: event, schedule: schedule, start_time: DateTime.parse("#{Date.current + 1} 10:00").utc) }
it 'returns false when schedule_public is disabled' do
program.update!(schedule_public: false, selected_schedule: schedule)
expect(program.any_published_schedule?).to be false
end
it 'returns false when schedule_public is enabled but no schedule is selected' do
program.update!(schedule_public: true, selected_schedule: nil)
expect(program.any_published_schedule?).to be false
end
it 'returns true when schedule_public is enabled and the selected schedule has events' do
program.update!(schedule_public: true, selected_schedule: schedule)
expect(program.any_published_schedule?).to be true
end
end
describe '#cfp' do
it 'returns the cfp for events' do
create(:cfp, cfp_type: 'events', program: program, end_date: Date.current + 1)