Skip to content

Commit

Permalink
Fix bug preventing the display of CFP options
Browse files Browse the repository at this point in the history
continues #14
  • Loading branch information
AndrewKvalheim committed Jun 13, 2021
1 parent d44be85 commit d613080
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/views/admin/cfps/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@

%dt.tall-definition-label Speakers todo: remind to fill out bio
%dd#speaker_proposals_req_bio
- @program.speaker_proposals_req_bio ? 'Yes' : 'No'
= @program.speaker_proposals_req_bio ? 'Yes' : 'No'

%dt.tall-definition-label Speakers todo: remind to add subtitle
%dd#speaker_proposals_req_subtitle
- @program.speaker_proposals_req_subtitle ? 'Yes' : 'No'
= @program.speaker_proposals_req_subtitle ? 'Yes' : 'No'

%dt.tall-definition-label Speakers todo: remind to add a commercial
%dd#speaker_proposals_req_commercial
- @program.speaker_proposals_req_commercial ? 'Yes' : 'No'
= @program.speaker_proposals_req_commercial ? 'Yes' : 'No'

%dt.tall-definition-label Speakers todo: remind to add track
%dd#speaker_proposals_req_track
- @program.speaker_proposals_req_track ? 'Yes' : 'No'
= @program.speaker_proposals_req_track ? 'Yes' : 'No'

%dt.tall-definition-label Speakers todo: remind to add difficulty level
%dd#speaker_proposals_req_difficulty_level
- @program.speaker_proposals_req_difficulty_level ? 'Yes' : 'No'
= @program.speaker_proposals_req_difficulty_level ? 'Yes' : 'No'
.row
.col-md-12.text-right
= link_to(edit_admin_conference_program_cfp_path(@conference.short_title), class: 'btn btn-primary') do
Expand Down
27 changes: 27 additions & 0 deletions spec/features/cfp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,26 @@
page.execute_script(
"$('#registration-period-end-datepicker').val('#{(today + 6).strftime('%d/%m/%Y')}')")

choose 'cfp[program_attributes][speaker_proposals_req_speaker_event_reg]', option: 'true'
choose 'cfp[program_attributes][speaker_proposals_req_bio]', option: 'true'
choose 'cfp[program_attributes][speaker_proposals_req_subtitle]', option: 'true'
choose 'cfp[program_attributes][speaker_proposals_req_commercial]', option: 'false'
choose 'cfp[program_attributes][speaker_proposals_req_track]', option: 'false'
choose 'cfp[program_attributes][speaker_proposals_req_difficulty_level]', option: 'false'

click_button 'Create Cfp'

# Validations
expect(flash)
.to eq('Call for papers successfully created.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 6).strftime('%A, %B %-d. %Y'))
expect(page).to have_content('Speakers todo: remind to register for event Yes')
expect(page).to have_content('Speakers todo: remind to fill out bio Yes')
expect(page).to have_content('Speakers todo: remind to add subtitle Yes')
expect(page).to have_content('Speakers todo: remind to add a commercial No')
expect(page).to have_content('Speakers todo: remind to add track No')
expect(page).to have_content('Speakers todo: remind to add difficulty level No')

expect(Cfp.count).to eq(expected_count)
end
Expand Down Expand Up @@ -60,13 +73,27 @@
page.execute_script(
"$('#registration-period-end-datepicker').val('#{(today + 14).strftime('%d/%m/%Y')}')")

# Set options
choose 'cfp[program_attributes][speaker_proposals_req_speaker_event_reg]', option: 'true'
choose 'cfp[program_attributes][speaker_proposals_req_bio]', option: 'true'
choose 'cfp[program_attributes][speaker_proposals_req_subtitle]', option: 'false'
choose 'cfp[program_attributes][speaker_proposals_req_commercial]', option: 'false'
choose 'cfp[program_attributes][speaker_proposals_req_track]', option: 'true'
choose 'cfp[program_attributes][speaker_proposals_req_difficulty_level]', option: 'true'

click_button 'Update Cfp'

# Validations
expect(flash)
.to eq('Call for papers successfully updated.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 14).strftime('%A, %B %-d. %Y'))
expect(page).to have_content('Speakers todo: remind to register for event Yes')
expect(page).to have_content('Speakers todo: remind to fill out bio Yes')
expect(page).to have_content('Speakers todo: remind to add subtitle No')
expect(page).to have_content('Speakers todo: remind to add a commercial No')
expect(page).to have_content('Speakers todo: remind to add track Yes')
expect(page).to have_content('Speakers todo: remind to add difficulty level Yes')
expect(Cfp.count).to eq(expected_count)
end
end
Expand Down

0 comments on commit d613080

Please sign in to comment.