From b5c9b03a1008467af60ff67a7d8c3d5827f79948 Mon Sep 17 00:00:00 2001 From: Kriszta Matyi Date: Sun, 30 Oct 2022 19:38:42 -0700 Subject: [PATCH] Adds feature spec for admin creating a virtual event --- app/assets/stylesheets/partials/_layout.scss | 2 +- spec/features/admin/event_spec.rb | 33 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/partials/_layout.scss b/app/assets/stylesheets/partials/_layout.scss index 8263b0f29..859f8ff64 100644 --- a/app/assets/stylesheets/partials/_layout.scss +++ b/app/assets/stylesheets/partials/_layout.scss @@ -1,7 +1,7 @@ @import "partials/colors"; #top { - margin-top: 82px; + margin-top: 96px; } .main-footer { diff --git a/spec/features/admin/event_spec.rb b/spec/features/admin/event_spec.rb index 865b59ca7..a248e7705 100644 --- a/spec/features/admin/event_spec.rb +++ b/spec/features/admin/event_spec.rb @@ -45,6 +45,39 @@ end end + describe 'can successfully create a virtual event' do + scenario 'when they fill in all mandatory fields' do + sponsor = Fabricate(:sponsor) + date = Time.zone.today + 2.days + visit new_admin_event_path + + fill_in 'Event Name', with: 'A test virtual event' + fill_in 'Slug', with: 'a-test-virtual-event' + fill_in 'Date', with: date + fill_in 'Begins at', with: '16:00' + fill_in 'Ends at', with: '18:00' + fill_in 'Description', with: 'A test virtual event description' + fill_in 'RSVP instructions', with: 'Some instructions' + fill_in 'Schedule', with: '9:00 Sign up & breakfast
9:30 kick off' + fill_in 'Coach spaces', with: '19' + fill_in 'Student spaces', with: '25' + check 'This is a virtual event' + click_on 'Save' + + expect(page).to have_content('Event successfully created') + + expect(page).to have_content('A test virtual event') + expect(page).to have_content(humanize_date(date)) + expect(page).to have_content('A test virtual event description') + expect(page).to have_content('25 student spots, 19 coach spots') + expect(page).to have_content('9:00 Sign up & breakfast 9:30 kick off') + + within '#host' do + expect(page).to have_content('This is a virtual event.') + end + end + end + describe 'can not create an event' do scenario 'when they don\'t fill in any of the events details' do visit new_admin_event_path