From 19af4e4f1274d4369036eb8c1495a0e442a6fd5e Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 16 Apr 2021 23:08:44 +0800 Subject: [PATCH 01/18] [fix]Fix rake data:test by including webmock --- lib/tasks/demo_data_for_development.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/demo_data_for_development.rake b/lib/tasks/demo_data_for_development.rake index d54f8cfb..b3e15ae1 100644 --- a/lib/tasks/demo_data_for_development.rake +++ b/lib/tasks/demo_data_for_development.rake @@ -1,4 +1,5 @@ # frozen_string_literal: true +require 'webmock' namespace :data do desc 'Create demo data for our local development' From 2f8cee3c4fb1d31f82a6d0a3e06e06d262f13922 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Sat, 17 Apr 2021 00:00:52 +0800 Subject: [PATCH 02/18] [feat]Splashpage will display happening next event if no event is happening now --- app/controllers/conferences_controller.rb | 19 ++++++++++++++----- app/helpers/conference_helper.rb | 16 ++++++++++++++++ app/models/event_schedule.rb | 8 ++++++++ .../conferences/_about_and_happening_now.haml | 3 ++- app/views/conferences/_happening_now.haml | 6 +++++- app/views/conferences/show.html.haml | 3 ++- lib/tasks/demo_data_for_development.rake | 1 + 7 files changed, 48 insertions(+), 8 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 35e6b709..7f3bbfbd 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -61,11 +61,7 @@ class ConferencesController < ApplicationController @booths = @conference.confirmed_booths.order('title') end if splashpage.include_happening_now - events_schedules_list = get_happening_now_events_schedules(@conference) - @events_schedules_limit = EVENTS_PER_PAGE - @events_schedules_length = events_schedules_list.length - @pagy, @events_schedules = pagy_array(events_schedules_list, items: @events_schedules_limit, link_extra: 'data-remote="true"') - @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) + load_happening_now end end if splashpage.include_registrations || splashpage.include_tickets @@ -151,4 +147,17 @@ class ConferencesController < ApplicationController def current_user_has_unpaid_tickets? current_user && current_user_tickets.unpaid.any? end + + def load_happening_now + events_schedules_list = get_happening_now_events_schedules(@conference) + @is_happening_next = false + if events_schedules_list.empty? + events_schedules_list = get_happening_next_events_schedules(@conference) + @is_happening_next = true + end + @events_schedules_limit = EVENTS_PER_PAGE + @events_schedules_length = events_schedules_list.length + @pagy, @events_schedules = pagy_array(events_schedules_list, items: @events_schedules_limit, link_extra: 'data-remote="true"') + @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) + end end diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index cf2c06ce..9c22ac5f 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -85,4 +85,20 @@ module ConferenceHelper events_schedules ||= [] events_schedules end + + def get_happening_next_events_schedules(conference) + events_schedules = conference.program.selected_event_schedules( + includes: [:room, { event: %i[track event_type speakers submitter] }] + ).select(&:happening_next?) + + if events_schedules.empty? + return [] + end + + # events_schedules have been sorted by start_time in selected_event_schedules + happening_next_time = events_schedules[0].start_time + events_schedules = events_schedules.select { |s| s.start_time == happening_next_time } + + events_schedules + end end diff --git a/app/models/event_schedule.rb b/app/models/event_schedule.rb index 036a89f2..4ab7baad 100644 --- a/app/models/event_schedule.rb +++ b/app/models/event_schedule.rb @@ -70,6 +70,14 @@ class EventSchedule < ApplicationRecord event_time_range.overlaps?(now_range) end + def happening_next? + # TODO: Save start_time with local timezone info when making an event schedule + in_tz_start = start_time.in_time_zone(timezone) + in_tz_start -= in_tz_start.utc_offset + + in_tz_start >= Time.now + end + def self.withdrawn_or_canceled_event_schedules(schedule_ids) EventSchedule .unscoped diff --git a/app/views/conferences/_about_and_happening_now.haml b/app/views/conferences/_about_and_happening_now.haml index c048b28d..ead36206 100644 --- a/app/views/conferences/_about_and_happening_now.haml +++ b/app/views/conferences/_about_and_happening_now.haml @@ -3,7 +3,8 @@ = render 'happening_now', conference: conference, events_schedules: events_schedules, pagy: pagy, events_schedules_length: events_schedules_length, - events_schedules_limit: events_schedules_limit + events_schedules_limit: events_schedules_limit, + is_happening_next: is_happening_next = content_for :about do #about diff --git a/app/views/conferences/_happening_now.haml b/app/views/conferences/_happening_now.haml index 66355a82..61ef9e83 100644 --- a/app/views/conferences/_happening_now.haml +++ b/app/views/conferences/_happening_now.haml @@ -1,7 +1,11 @@ - if conference.splashpage.include_program && conference.splashpage.include_happening_now - if events_schedules.any? .row - %h2.text-center{ style: 'margin-bottom:30px' } Happening Now + %h2.text-center{ style: 'margin-bottom:30px' } + - if is_happening_next + Happening Next + - else + Happening Now - events_schedules.each do |event_schedule| = render 'schedules/event', conference: conference, event_schedule: event_schedule, event: event_schedule.event, is_brief: true - if events_schedules_length > events_schedules_limit diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 3a73c0b0..21581351 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -49,7 +49,8 @@ = render 'about_and_happening_now', conference: @conference, events_schedules: @events_schedules, pagy: @pagy, events_schedules_length: @events_schedules_length, - events_schedules_limit: @events_schedules_limit + events_schedules_limit: @events_schedules_limit, + is_happening_next: @is_happening_next -# calls for content, or program - if @conference.splashpage.include_cfp diff --git a/lib/tasks/demo_data_for_development.rake b/lib/tasks/demo_data_for_development.rake index b3e15ae1..026f3e20 100644 --- a/lib/tasks/demo_data_for_development.rake +++ b/lib/tasks/demo_data_for_development.rake @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'webmock' namespace :data do From 59c5d432edb8caeff6aec9d4fb372bd1370151c6 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Sat, 17 Apr 2021 00:22:17 +0800 Subject: [PATCH 03/18] [style]Remove extra white space --- app/views/conferences/_happening_now.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/conferences/_happening_now.haml b/app/views/conferences/_happening_now.haml index 61ef9e83..f1e75625 100644 --- a/app/views/conferences/_happening_now.haml +++ b/app/views/conferences/_happening_now.haml @@ -1,7 +1,7 @@ - if conference.splashpage.include_program && conference.splashpage.include_happening_now - if events_schedules.any? .row - %h2.text-center{ style: 'margin-bottom:30px' } + %h2.text-center{ style: 'margin-bottom:30px' } - if is_happening_next Happening Next - else From ab15a3fb10e17bfbc773e48c8d614b9cd95b80b3 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Sat, 17 Apr 2021 08:30:07 +0800 Subject: [PATCH 04/18] [refractor]Use ? methods instead of boolean variables; rename happening_next? to happening_later? --- app/controllers/conferences_controller.rb | 16 ++++++++-------- app/helpers/conference_helper.rb | 2 +- app/models/event_schedule.rb | 2 +- app/views/admin/emails/_help.html.haml | 2 +- app/views/admin/splashpages/show.html.haml | 2 +- app/views/conferences/show.html.haml | 12 ++++++------ 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 7f3bbfbd..efe33354 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -40,7 +40,7 @@ class ConferencesController < ApplicationController @image_url = "#{request.protocol}#{request.host}#{@conference.picture}" - if splashpage.include_cfp + if splashpage.include_cfp? cfps = @conference.program.cfps @call_for_events = cfps.find { |call| call.cfp_type == 'events' } if @call_for_events.try(:open?) @@ -50,27 +50,27 @@ class ConferencesController < ApplicationController @call_for_tracks = cfps.find { |call| call.cfp_type == 'tracks' } @call_for_booths = cfps.find { |call| call.cfp_type == 'booths' } end - if splashpage.include_program + if splashpage.include_program? @highlights = @conference.highlighted_events.eager_load(:speakers) - if splashpage.include_tracks + if splashpage.include_tracks? @tracks = @conference.confirmed_tracks.eager_load( :room ).order('tracks.name') end - if splashpage.include_booths + if splashpage.include_booths? @booths = @conference.confirmed_booths.order('title') end - if splashpage.include_happening_now + if splashpage.include_happening_now? load_happening_now end end - if splashpage.include_registrations || splashpage.include_tickets + if splashpage.include_registrations? || splashpage.include_tickets? @tickets = @conference.tickets.visible.order('price_cents') end - if splashpage.include_lodgings + if splashpage.include_lodgings? @lodgings = @conference.lodgings.order('id') end - if splashpage.include_sponsors + if splashpage.include_sponsors? @sponsorship_levels = @conference.sponsorship_levels.eager_load( :sponsors ).order('sponsorship_levels.position ASC', 'sponsors.name') diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index 9c22ac5f..16a8cbb6 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -89,7 +89,7 @@ module ConferenceHelper def get_happening_next_events_schedules(conference) events_schedules = conference.program.selected_event_schedules( includes: [:room, { event: %i[track event_type speakers submitter] }] - ).select(&:happening_next?) + ).select(&:happening_later?) if events_schedules.empty? return [] diff --git a/app/models/event_schedule.rb b/app/models/event_schedule.rb index 4ab7baad..f8a41d64 100644 --- a/app/models/event_schedule.rb +++ b/app/models/event_schedule.rb @@ -70,7 +70,7 @@ class EventSchedule < ApplicationRecord event_time_range.overlaps?(now_range) end - def happening_next? + def happening_later? # TODO: Save start_time with local timezone info when making an event schedule in_tz_start = start_time.in_time_zone(timezone) in_tz_start -= in_tz_start.utc_offset diff --git a/app/views/admin/emails/_help.html.haml b/app/views/admin/emails/_help.html.haml index 371bac7b..9de1e0f8 100644 --- a/app/views/admin/emails/_help.html.haml +++ b/app/views/admin/emails/_help.html.haml @@ -51,7 +51,7 @@ - if @conference.program.schedule_public %td {schedule_link} %td The link to complete schedule of the conference - - if @conference.splashpage && @conference.splashpage.public + - if @conference.splashpage && @conference.splashpage.public? %tr %td {conference_splash_link} %td The link to conference splash page diff --git a/app/views/admin/splashpages/show.html.haml b/app/views/admin/splashpages/show.html.haml index 08edb140..e3732b89 100644 --- a/app/views/admin/splashpages/show.html.haml +++ b/app/views/admin/splashpages/show.html.haml @@ -49,7 +49,7 @@ %i{ class: "fa-li #{icon_for_todo @splashpage.include_social_media?}" } Display social media links %li - - if @conference.splashpage && @conference.splashpage.public + - if @conference.splashpage && @conference.splashpage.public? %i{ class: "fa-li #{icon_for_todo @splashpage.public?}" } %text-muted.publicorprivate Public - else diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 21581351..ed642f34 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -53,18 +53,18 @@ is_happening_next: @is_happening_next -# calls for content, or program - - if @conference.splashpage.include_cfp + - if @conference.splashpage.include_cfp? = render 'call_for_content', conference: @conference, call_for_events: @call_for_events, call_for_tracks: @call_for_tracks, call_for_booths: @call_for_booths, event_types: @event_types, tracks: @track_names - - if @conference.splashpage.include_program + - if @conference.splashpage.include_program? = render 'program', conference: @conference, tracks: @tracks, highlights: @highlights, booths: @booths -# attendance/registration - - if @conference.splashpage.include_registrations + - if @conference.splashpage.include_registrations? - if @conference.registration_open? = render 'registration', conference: @conference, registration_period: @conference.registration_period, @@ -73,20 +73,20 @@ = render 'tickets', conference: @conference, tickets: @tickets -# geo - - if @conference.splashpage.include_venue && @conference.venue + - if @conference.splashpage.include_venue? && @conference.venue = render 'venue', conference: @conference, venue: @conference.venue, commercial: @conference.venue.commercial - if @conference.splashpage.include_lodgings && @conference.lodgings.any? = render 'lodging', venue: @conference.venue, lodgings: @lodgings -# sponsorship - - if @conference.splashpage.include_sponsors + - if @conference.splashpage.include_sponsors? = render 'sponsors', conference: @conference, sponsorship_levels: @sponsorship_levels, sponsors: @sponsors -# footer - - if @conference.splashpage.include_social_media + - if @conference.splashpage.include_social_media? - if @conference.contact.has_social_media? = render 'social_media', contact: @conference.contact = render 'footer' From b32f2416dadb3859037cd125d405ce1efa1f1fa4 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 13:23:49 +0800 Subject: [PATCH 05/18] [test]Add test for SchedulersController#happening_later? --- spec/models/event_schedule_spec.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/spec/models/event_schedule_spec.rb b/spec/models/event_schedule_spec.rb index b160cf15..d84b2611 100644 --- a/spec/models/event_schedule_spec.rb +++ b/spec/models/event_schedule_spec.rb @@ -165,4 +165,31 @@ describe EventSchedule do end end end + + describe 'happening_later' do + let!(:conference2) { create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24) } + let!(:program) { conference2.program } + let!(:selected_schedule) { create(:schedule, program: program) } + let!(:scheduled_event1) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed', abstract: '`markdown`') + end + let!(:event_schedule1) { create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } + let!(:scheduled_event2) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed') + end + let!(:event_schedule2) { create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 2.hour).strftime('%a, %d %b %Y %H:%M:%S')) } + let!(:scheduled_event3) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed') + end + let!(:event_schedule3) { create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) - 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } + + it 'returns true if the event is happening in the future' do + expect(event_schedule1.happening_later?).to be true + expect(event_schedule2.happening_later?).to be true + expect(event_schedule3.happening_later?).to be false + end + end end From 1fd1d395d5dcaf5c036ec21ec46eeb924d51f684 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 13:33:00 +0800 Subject: [PATCH 06/18] [test]Add test for ConferenceHelper#get_happening_next_events_schedules --- spec/helpers/conference_helper_spec.rb | 34 ++++++++++++++++++++++++++ spec/models/event_schedule_spec.rb | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/spec/helpers/conference_helper_spec.rb b/spec/helpers/conference_helper_spec.rb index 4ea48496..d3359f06 100644 --- a/spec/helpers/conference_helper_spec.rb +++ b/spec/helpers/conference_helper_spec.rb @@ -99,4 +99,38 @@ describe ConferenceHelper, type: :helper do expect(conference_color(conference2)).to eq('#0B3559') end end + + describe '#get_happening_next_events_schedules' do + let!(:conference2) { create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24) } + let!(:program) { conference2.program } + let!(:selected_schedule) { create(:schedule, program: program) } + let!(:scheduled_event1) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed', abstract: '`markdown`') + end + let!(:event_schedule1) { create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } + let!(:scheduled_event2) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed') + end + let!(:event_schedule2) { create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } + let!(:scheduled_event3) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed') + end + let!(:event_schedule3) { create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) - 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } + let!(:scheduled_event4) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed') + end + let!(:event_schedule4) { create(:event_schedule, event: scheduled_event4, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 2.hours).strftime('%a, %d %b %Y %H:%M:%S')) } + + it 'returns all the events happening at the earliest time in the future but not later or in the past' do + events_schedules = get_happening_next_events_schedules(conference2) + expect(events_schedules).to include(event_schedule1) + expect(events_schedules).to include(event_schedule2) + expect(events_schedules).to_not include(event_schedule3) + expect(events_schedules).to_not include(event_schedule4) + end + end end diff --git a/spec/models/event_schedule_spec.rb b/spec/models/event_schedule_spec.rb index d84b2611..26cb5dff 100644 --- a/spec/models/event_schedule_spec.rb +++ b/spec/models/event_schedule_spec.rb @@ -185,7 +185,7 @@ describe EventSchedule do create(:event, program: program, state: 'confirmed') end let!(:event_schedule3) { create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) - 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } - + it 'returns true if the event is happening in the future' do expect(event_schedule1.happening_later?).to be true expect(event_schedule2.happening_later?).to be true From 4e68989955a53f4a9e43735af766d494faf3ae35 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 14:24:54 +0800 Subject: [PATCH 07/18] [test]Add integration tests for the happening now section on the splashpage --- app/views/conferences/_happening_now.haml | 2 +- spec/features/splashpage_spec.rb | 82 +++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/app/views/conferences/_happening_now.haml b/app/views/conferences/_happening_now.haml index f1e75625..e8379f65 100644 --- a/app/views/conferences/_happening_now.haml +++ b/app/views/conferences/_happening_now.haml @@ -13,4 +13,4 @@ != pagy_bootstrap_nav_js(pagy) - else .row - %h3.text-center There are no events happening now. + %h3.text-center There are no events happening now and next. diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index 69e1c6ae..350a09c4 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -80,4 +80,86 @@ feature Splashpage do end end end + + context 'happening now section is turned on' do + let!(:conference2) { create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24) } + let!(:program) { conference2.program } + let!(:selected_schedule) { create(:schedule, program: program) } + let!(:splashpage) { create(:splashpage, conference: conference2, public: true)} + + let!(:scheduled_event1) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed', abstract: '`markdown`') + end + let!(:scheduled_event2) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed') + end + let!(:scheduled_event3) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed') + end + let!(:scheduled_event4) do + program.update_attributes!(selected_schedule: selected_schedule) + create(:event, program: program, state: 'confirmed') + end + + before :each do + sign_in participant + end + + it 'displays \'There are no events happening now and next.\' if nothing is happening now and next' do + visit conference_path(conference2.short_title) + happening_now = page.find('#happening-now') + expect(happening_now).to have_content('There are no events happening now and next.') + end + + it 'shows all events happening next if nothing is happening now' do + event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + visit conference_path(conference2.short_title) + happening_now = page.find('#happening-now') + expect(happening_now).to have_content(event_schedule1.event.title) + expect(happening_now).to have_content(event_schedule2.event.title) + end + + it 'only shows all events happening now if something is happening now and next' do + event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) + visit conference_path(conference2.short_title) + happening_now = page.find('#happening-now') + expect(happening_now).to have_content(event_schedule3.event.title) + expect(happening_now).not_to have_content(event_schedule1.event.title) + expect(happening_now).not_to have_content(event_schedule2.event.title) + end + + it 'only shows events happening at the earliest time, not at a later time in the future' do + event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 2.hours).strftime('%a, %d %b %Y %H:%M:%S')) + visit conference_path(conference2.short_title) + happening_now = page.find('#happening-now') + expect(happening_now).to have_content(event_schedule1.event.title) + expect(happening_now).to have_content(event_schedule2.event.title) + expect(happening_now).not_to have_content(event_schedule3.event.title) + end + + it 'only shows 3 events happening now because of pagination' do + event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule4 = create(:event_schedule, event: scheduled_event4, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) + + visit conference_path(conference2.short_title) + happening_now = page.find('#happening-now') + expect(happening_now).to have_content(event_schedule1.event.title) + expect(happening_now).to have_content(event_schedule2.event.title) + expect(happening_now).to have_content(event_schedule3.event.title) + expect(happening_now).not_to have_content(event_schedule4.event.title) + + visit conference_path(conference2.short_title, page: 2) + expect(happening_now).to have_content(event_schedule4.event.title) + end + end end From c7490dfe775a80dda63ea5c0c963afa068b51611 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 17:50:01 +0800 Subject: [PATCH 08/18] [fix]Fix splashpage spec --- spec/features/splashpage_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index 350a09c4..0b5316e8 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -81,7 +81,7 @@ feature Splashpage do end end - context 'happening now section is turned on' do + context 'happening now section', js: true do let!(:conference2) { create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24) } let!(:program) { conference2.program } let!(:selected_schedule) { create(:schedule, program: program) } @@ -159,6 +159,7 @@ feature Splashpage do expect(happening_now).not_to have_content(event_schedule4.event.title) visit conference_path(conference2.short_title, page: 2) + happening_now = page.find('#happening-now') expect(happening_now).to have_content(event_schedule4.event.title) end end From d3ed87211a0a759b8d664c33505f0fc680b6c119 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 18:26:54 +0800 Subject: [PATCH 09/18] [temp]Try feature:true --- spec/features/splashpage_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index 0b5316e8..b9a9b778 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -81,7 +81,7 @@ feature Splashpage do end end - context 'happening now section', js: true do + context 'happening now section', feature: true, js: true do let!(:conference2) { create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24) } let!(:program) { conference2.program } let!(:selected_schedule) { create(:schedule, program: program) } From bb665c934fb02d1b553dc28edbfb03396d7d21a1 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 18:35:26 +0800 Subject: [PATCH 10/18] [test]Use scenario instead of it --- spec/features/splashpage_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index b9a9b778..29f91db1 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -108,13 +108,13 @@ feature Splashpage do sign_in participant end - it 'displays \'There are no events happening now and next.\' if nothing is happening now and next' do + scenario 'displays \'There are no events happening now and next.\' if nothing is happening now and next' do visit conference_path(conference2.short_title) happening_now = page.find('#happening-now') expect(happening_now).to have_content('There are no events happening now and next.') end - it 'shows all events happening next if nothing is happening now' do + scenario 'shows all events happening next if nothing is happening now' do event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) visit conference_path(conference2.short_title) @@ -123,7 +123,7 @@ feature Splashpage do expect(happening_now).to have_content(event_schedule2.event.title) end - it 'only shows all events happening now if something is happening now and next' do + scenario 'only shows all events happening now if something is happening now and next' do event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) @@ -134,7 +134,7 @@ feature Splashpage do expect(happening_now).not_to have_content(event_schedule2.event.title) end - it 'only shows events happening at the earliest time, not at a later time in the future' do + scenario 'only shows events happening at the earliest time, not at a later time in the future' do event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 2.hours).strftime('%a, %d %b %Y %H:%M:%S')) @@ -145,7 +145,7 @@ feature Splashpage do expect(happening_now).not_to have_content(event_schedule3.event.title) end - it 'only shows 3 events happening now because of pagination' do + scenario 'only shows 3 events happening now because of pagination' do event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) From 9af06715e1c624460e00b5f7a95ec98d8188de38 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 18:37:04 +0800 Subject: [PATCH 11/18] [temp]Print page.html --- spec/features/splashpage_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index 29f91db1..ea3efcd9 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -110,6 +110,7 @@ feature Splashpage do scenario 'displays \'There are no events happening now and next.\' if nothing is happening now and next' do visit conference_path(conference2.short_title) + p page.html happening_now = page.find('#happening-now') expect(happening_now).to have_content('There are no events happening now and next.') end From 54e051be90e733728206e91e4546323389817a72 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 18:47:21 +0800 Subject: [PATCH 12/18] [fix]Use full_splashpage instead of splashpage --- spec/features/splashpage_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index ea3efcd9..08fb3992 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -85,7 +85,7 @@ feature Splashpage do let!(:conference2) { create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24) } let!(:program) { conference2.program } let!(:selected_schedule) { create(:schedule, program: program) } - let!(:splashpage) { create(:splashpage, conference: conference2, public: true)} + let!(:splashpage) { create(:full_splashpage, conference: conference2, public: true)} let!(:scheduled_event1) do program.update_attributes!(selected_schedule: selected_schedule) From 5de9f97ea82b288cd973352e3e2267f7511420ef Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 18:54:01 +0800 Subject: [PATCH 13/18] [fix]Remove print --- spec/features/splashpage_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index 08fb3992..b2f26010 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -110,7 +110,6 @@ feature Splashpage do scenario 'displays \'There are no events happening now and next.\' if nothing is happening now and next' do visit conference_path(conference2.short_title) - p page.html happening_now = page.find('#happening-now') expect(happening_now).to have_content('There are no events happening now and next.') end From 47f183fc8956f489f7a8a9068e0e0125dc6427d2 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 19:01:31 +0800 Subject: [PATCH 14/18] [style]Fix duplicate code in conference_helper --- app/helpers/conference_helper.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index 16a8cbb6..29db24d4 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -79,17 +79,13 @@ module ConferenceHelper end def get_happening_now_events_schedules(conference) - events_schedules = conference.program.selected_event_schedules( - includes: [:room, { event: %i[track event_type speakers submitter] }] - ).select(&:happening_now?) + events_schedules = filter_events_schedules(conference, :happening_now?) events_schedules ||= [] events_schedules end def get_happening_next_events_schedules(conference) - events_schedules = conference.program.selected_event_schedules( - includes: [:room, { event: %i[track event_type speakers submitter] }] - ).select(&:happening_later?) + events_schedules = filter_events_schedules(conference, :happening_later?) if events_schedules.empty? return [] @@ -101,4 +97,12 @@ module ConferenceHelper events_schedules end + + private + + def filter_events_schedules(conference, filter) + conference.program.selected_event_schedules( + includes: [:room, { event: %i[track event_type speakers submitter] }] + ).select(&filter) + end end From 24d2fa89a8c8d0ba051b4ba2dcca583c5fa4a0b8 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 19 Apr 2021 19:23:41 +0800 Subject: [PATCH 15/18] [style]Remove unused code --- app/controllers/conferences_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index efe33354..529d9fb4 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -158,6 +158,5 @@ class ConferencesController < ApplicationController @events_schedules_limit = EVENTS_PER_PAGE @events_schedules_length = events_schedules_list.length @pagy, @events_schedules = pagy_array(events_schedules_list, items: @events_schedules_limit, link_extra: 'data-remote="true"') - @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) end end From 2280d1f7b60e6f81ef131789168e5767b8f32cfb Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 20 Apr 2021 13:21:19 +0800 Subject: [PATCH 16/18] [fix]Change wording when no events is happening now or next --- app/views/conferences/_happening_now.haml | 2 +- spec/features/splashpage_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/conferences/_happening_now.haml b/app/views/conferences/_happening_now.haml index e8379f65..563a4b4f 100644 --- a/app/views/conferences/_happening_now.haml +++ b/app/views/conferences/_happening_now.haml @@ -13,4 +13,4 @@ != pagy_bootstrap_nav_js(pagy) - else .row - %h3.text-center There are no events happening now and next. + %h3.text-center There are no events scheduled yet. diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index b2f26010..1c97a451 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -108,10 +108,10 @@ feature Splashpage do sign_in participant end - scenario 'displays \'There are no events happening now and next.\' if nothing is happening now and next' do + scenario 'displays \'There are no events scheduled yet.\' if nothing is happening now and next' do visit conference_path(conference2.short_title) happening_now = page.find('#happening-now') - expect(happening_now).to have_content('There are no events happening now and next.') + expect(happening_now).to have_content('There are no events scheduled yet.') end scenario 'shows all events happening next if nothing is happening now' do From e4df68f2d8744920dd6ffd91b35f1157d561bc31 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 20 Apr 2021 13:48:47 +0800 Subject: [PATCH 17/18] [fix]Store current time to a variable to make sure timestamps are the same --- spec/features/splashpage_spec.rb | 26 +++++++++++++------------- spec/helpers/conference_helper_spec.rb | 9 +++++---- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index 1c97a451..9f1bf40e 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -103,7 +103,7 @@ feature Splashpage do program.update_attributes!(selected_schedule: selected_schedule) create(:event, program: program, state: 'confirmed') end - + let!(:current_time) { Time.now.in_time_zone(conference2.timezone) } before :each do sign_in participant end @@ -115,8 +115,8 @@ feature Splashpage do end scenario 'shows all events happening next if nothing is happening now' do - event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) - event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) visit conference_path(conference2.short_title) happening_now = page.find('#happening-now') expect(happening_now).to have_content(event_schedule1.event.title) @@ -124,9 +124,9 @@ feature Splashpage do end scenario 'only shows all events happening now if something is happening now and next' do - event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) - event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) - event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S')) visit conference_path(conference2.short_title) happening_now = page.find('#happening-now') expect(happening_now).to have_content(event_schedule3.event.title) @@ -135,9 +135,9 @@ feature Splashpage do end scenario 'only shows events happening at the earliest time, not at a later time in the future' do - event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) - event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) - event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 2.hours).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (current_time + 2.hours).strftime('%a, %d %b %Y %H:%M:%S')) visit conference_path(conference2.short_title) happening_now = page.find('#happening-now') expect(happening_now).to have_content(event_schedule1.event.title) @@ -146,10 +146,10 @@ feature Splashpage do end scenario 'only shows 3 events happening now because of pagination' do - event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) - event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) - event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) - event_schedule4 = create(:event_schedule, event: scheduled_event4, schedule: selected_schedule, start_time: Time.now.in_time_zone(conference2.timezone).strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule1 = create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule2 = create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule3 = create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S')) + event_schedule4 = create(:event_schedule, event: scheduled_event4, schedule: selected_schedule, start_time: current_time.strftime('%a, %d %b %Y %H:%M:%S')) visit conference_path(conference2.short_title) happening_now = page.find('#happening-now') diff --git a/spec/helpers/conference_helper_spec.rb b/spec/helpers/conference_helper_spec.rb index d3359f06..5065411f 100644 --- a/spec/helpers/conference_helper_spec.rb +++ b/spec/helpers/conference_helper_spec.rb @@ -108,22 +108,23 @@ describe ConferenceHelper, type: :helper do program.update_attributes!(selected_schedule: selected_schedule) create(:event, program: program, state: 'confirmed', abstract: '`markdown`') end - let!(:event_schedule1) { create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } + let!(:current_time) { Time.now.in_time_zone(conference2.timezone) } + let!(:event_schedule1) { create(:event_schedule, event: scheduled_event1, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } let!(:scheduled_event2) do program.update_attributes!(selected_schedule: selected_schedule) create(:event, program: program, state: 'confirmed') end - let!(:event_schedule2) { create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } + let!(:event_schedule2) { create(:event_schedule, event: scheduled_event2, schedule: selected_schedule, start_time: (current_time + 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } let!(:scheduled_event3) do program.update_attributes!(selected_schedule: selected_schedule) create(:event, program: program, state: 'confirmed') end - let!(:event_schedule3) { create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) - 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } + let!(:event_schedule3) { create(:event_schedule, event: scheduled_event3, schedule: selected_schedule, start_time: (current_time - 1.hour).strftime('%a, %d %b %Y %H:%M:%S')) } let!(:scheduled_event4) do program.update_attributes!(selected_schedule: selected_schedule) create(:event, program: program, state: 'confirmed') end - let!(:event_schedule4) { create(:event_schedule, event: scheduled_event4, schedule: selected_schedule, start_time: (Time.now.in_time_zone(conference2.timezone) + 2.hours).strftime('%a, %d %b %Y %H:%M:%S')) } + let!(:event_schedule4) { create(:event_schedule, event: scheduled_event4, schedule: selected_schedule, start_time: (current_time + 2.hours).strftime('%a, %d %b %Y %H:%M:%S')) } it 'returns all the events happening at the earliest time in the future but not later or in the past' do events_schedules = get_happening_next_events_schedules(conference2) From ad5a6c264aa61b0b003e00c0232f87f27a42f05b Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 20 Apr 2021 13:52:44 +0800 Subject: [PATCH 18/18] [style]Fix style --- spec/features/splashpage_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index 9f1bf40e..7b9b8866 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -104,6 +104,7 @@ feature Splashpage do create(:event, program: program, state: 'confirmed') end let!(:current_time) { Time.now.in_time_zone(conference2.timezone) } + before :each do sign_in participant end