diff --git a/app/views/admin/events/_voting.html.haml b/app/views/admin/events/_voting.html.haml
index 55fd6498..9a55475e 100644
--- a/app/views/admin/events/_voting.html.haml
+++ b/app/views/admin/events/_voting.html.haml
@@ -17,16 +17,16 @@
Voters
%td
= raters(@votable_fields)
- %table.table
- %thead
+ %table.table
+ %thead
+ %td.col-md-2
+ %b Your Votes
+ - @votable_fields.each do |field|
+ %tr
%td.col-md-2
- %b Your Votes
- - @votable_fields.each do |field|
- %tr
- %td.col-md-2
- = field.title
- %td
- = rating_for_user @event, current_user, field.title, star: field.stars
+ = field.title
+ %td
+ = rating_for_user @event, current_user, field.title, star: field.stars
- else
%b
= voting_open_or_close(@program)
diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb
index b5620475..2051ed66 100644
--- a/spec/features/proposals_spec.rb
+++ b/spec/features/proposals_spec.rb
@@ -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,10 +27,42 @@ 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
-
+
click_button 'New'
click_link "reject_event_#{@event.id}"
expect(flash).to eq('Event rejected!')