diff --git a/Gemfile.lock b/Gemfile.lock index 52965d29..24bc65a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -171,11 +171,15 @@ GEM railties (>= 3.0.0) faker (1.9.3) i18n (>= 0.7) - faraday (1.3.0) + faraday (1.4.1) + faraday-excon (~> 1.1) faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) multipart-post (>= 1.2, < 3) - ruby2_keywords + ruby2_keywords (>= 0.0.4) + faraday-excon (1.1.0) faraday-net_http (1.0.1) + faraday-net_http_persistent (1.1.0) fastimage (2.1.4) feature (1.4.0) ffi (1.10.0) @@ -293,7 +297,7 @@ GEM mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2021.0225) - mimemagic (0.4.3) + mimemagic (0.3.10) nokogiri (~> 1) rake mina (1.2.3) @@ -301,7 +305,7 @@ GEM rake mini_magick (4.9.5) mini_mime (1.0.3) - mini_portile2 (2.5.0) + mini_portile2 (2.5.1) minitest (5.14.4) momentjs-rails (2.20.1) railties (>= 3.1) @@ -320,7 +324,7 @@ GEM nenv (0.3.0) netrc (0.11.0) nio4r (2.5.7) - nokogiri (1.11.2) + nokogiri (1.11.3) mini_portile2 (~> 2.5.0) racc (~> 1.4) notiffany (0.1.1) @@ -332,7 +336,7 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - octokit (4.20.0) + octokit (4.21.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) omniauth (1.9.1) @@ -496,7 +500,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.4) + rexml (3.2.5) rolify (5.2.0) rqrcode (0.10.1) chunky_png (~> 1.0) @@ -637,7 +641,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.6.0) + unicode-display_width (1.6.1) unicode_utils (1.4.0) unobtrusive_flash (3.3.1) railties diff --git a/app/views/proposals/show.html.haml b/app/views/proposals/show.html.haml index 9df7901e..29697a70 100644 --- a/app/views/proposals/show.html.haml +++ b/app/views/proposals/show.html.haml @@ -25,9 +25,10 @@ .col-md-4 %p{style: "margin-top: 20px"} - if @event_schedule&.start_time - = link_to google_calendar_link(@event_schedule), target: '_blank', class: 'btn btn-success btn-mini' do - %i.fa.fa-calendar - Add to Google Calendar (beta) + - if user_signed_in? + = link_to google_calendar_link(@event_schedule), target: '_blank', class: 'btn btn-success btn-mini' do + %i.fa.fa-calendar + Add to Google Calendar (beta) - if can?(:update, @event) && @event.require_registration? = link_to 'Registrations', registrations_conference_program_proposal_path(@conference.short_title, @event), class: 'btn btn-mini btn-success' - if can?(:edit, @event) diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 42b0112d..856d28c9 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -213,7 +213,28 @@ feature Event do end end - context 'happening now or next section', feature: true, js: true do + context 'as a user, looking at a conference with scheduled events' do + before(:each) do + @program = conference.program + @selected_schedule = create(:schedule, program: @program) + @program.update_attributes!(selected_schedule: @selected_schedule) + @scheduled_event1 = create(:event, program: @program, state: 'confirmed', abstract: '`markdown`') + @event_schedule1 = create(:event_schedule, event: @scheduled_event1, schedule: @selected_schedule, start_time: conference.start_hour + 1.hour) + end + + scenario 'for a scheduled event, can add an event to google calendar if signed in', feature: true do + sign_in participant + visit conference_program_proposal_path(conference.short_title, @scheduled_event1.id) + expect(page).to have_content('Add to Google Calendar (beta)') + end + + scenario 'for a scheduled event, cannot add an event to google calendar if not signed on', feature: true do + visit conference_program_proposal_path(conference.short_title, @scheduled_event1.id) + expect(page).not_to have_content('Add to Google Calendar (beta)') + end + end + + context 'happening now or next section' do let!(:conference1) { create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24) } let!(:program) { conference1.program } let!(:selected_schedule) { create(:schedule, program: program) } @@ -311,9 +332,7 @@ feature Event do expect(happening_now).not_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) - expect(happening_now).to have_content(event_schedule4.event.title) - end end end