multiple changes

fix blind voting
added more tests
This commit is contained in:
Shlok Srivastava 2017-04-27 08:05:14 +00:00
parent ebe5fb704d
commit e92114a257
2 changed files with 43 additions and 10 deletions

View file

@ -15,6 +15,7 @@ feature Event do
@event = create(:event, program: conference.program, title: 'Example Proposal')
@event.event_users.create(user: participant, event_role: 'submitter')
@event.event_users.create(user: participant, event_role: 'speaker')
create(:votable_field, conference: conference, for_admin: true)
end
after(:each) do
@ -26,6 +27,38 @@ feature Event do
sign_in organizer
end
scenario 'for program with voting enabled can successfully vote' do
conference.program.update(rating_enabled: true, voting_start_date: Date.current - 1, voting_end_date: Date.current + 1)
visit admin_conference_program_event_path(conference.short_title, @event)
expect(page.has_content?('Overall Votes')).to eq true
expect(page.has_content?('Your Votes')).to eq true
end
scenario 'for program with voting disabled cannot successfuly vote' do
conference.program.update(rating_enabled: false, voting_start_date: Date.today, voting_end_date: Date.today + 1)
visit admin_conference_program_event_path(conference.short_title, @event)
expect(page.has_content?('Overall Votes')).to eq false
expect(page.has_content?('Your Votes')).to eq false
end
scenario 'for program with blind voting enabled cannot see overall votes' do
conference.program.update(rating_enabled: true, voting_start_date: Date.today, voting_end_date: Date.today + 1, blind_voting: true)
visit admin_conference_program_event_path(conference.short_title, @event)
expect(page.has_content?('Overall Votes')).to eq false
expect(page.has_content?('Your Votes')).to eq true
end
scenario 'for program with blind voting disabled can see overall votes' do
conference.program.update(rating_enabled: true, voting_start_date: Date.today, voting_end_date: Date.today + 1, blind_voting: false)
visit admin_conference_program_event_path(conference.short_title, @event)
expect(page.has_content?('Overall Votes')).to eq true
expect(page.has_content?('Your Votes')).to eq true
end
scenario 'rejects a proposal', feature: true, js: true do
visit admin_conference_program_events_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true