From cb7519f7a452ba3b9beb5446dc629c1af2e14f25 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Mon, 6 Jan 2020 22:49:55 +0200 Subject: [PATCH] Check CfP existence in proposal form --- app/views/proposals/_proposal_form.html.haml | 2 +- spec/features/proposals_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/proposals/_proposal_form.html.haml b/app/views/proposals/_proposal_form.html.haml index e4d72ae3..f9b8d96f 100644 --- a/app/views/proposals/_proposal_form.html.haml +++ b/app/views/proposals/_proposal_form.html.haml @@ -43,7 +43,7 @@ 250 words. - - if current_user.is_admin? or @program.cfp.enable_registrations? + - if current_user.is_admin? or @program.cfp&.enable_registrations? = f.inputs 'Enable pre-registration' do = f.input :require_registration, label: 'Require participants to register to your event' - message = @event.room ? "Value must be between 1 and #{@event.room.size}" : 'Check room capacity after scheduling.' diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 9bd0e1c3..665b20e4 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -91,6 +91,17 @@ feature Event do expect(User.count).to eq(expected_count_user) end + scenario 'edit proposal without cfp' do + conference = create(:conference) + proposal = create(:event, program: conference.program) + + sign_in proposal.submitter + + visit edit_conference_program_proposal_path(proposal.program.conference.short_title, proposal) + + expect(page).to have_content 'Proposal Information' + end + scenario 'update a proposal' do conference = create(:conference) create(:cfp, program: conference.program)