From 05f877cfe5564f421686b69653eb2a73ba43e3c1 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 25 Feb 2021 11:15:23 -0800 Subject: [PATCH] [test] Add tests for previewing proposal in admin page --- spec/features/proposals_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 4d25e9ce..6839f8dd 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -27,6 +27,21 @@ feature Event do sign_in organizer end + scenario 'can preview a proposal if it is public', feature: true, js: true do + visit admin_conference_program_event_path(conference.short_title, @event) + expect(page).to have_selector(:link_or_button, 'Preview') + click_link 'Preview' + expect(current_path).to eq(conference_program_proposal_path(conference.short_title, @event.id)) + end + + scenario 'cannot preview a proposal if it is not public', feature: true, js: true do + event = create(:event, program: conference.program, title: 'Example Proposal') + event.public = false + event.save! + visit admin_conference_program_event_path(conference.short_title, event) + expect(page).to_not have_selector(:link_or_button, 'Preview') + end + scenario 'rejects a proposal', feature: true, js: true do visit admin_conference_program_events_path(conference.short_title) expect(page).to have_content 'Example Proposal'