diff options
Diffstat (limited to 'site/features/step_definitions/voting_steps.rb')
-rw-r--r-- | site/features/step_definitions/voting_steps.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/site/features/step_definitions/voting_steps.rb b/site/features/step_definitions/voting_steps.rb index 0519397..db6a5a0 100644 --- a/site/features/step_definitions/voting_steps.rb +++ b/site/features/step_definitions/voting_steps.rb @@ -20,3 +20,37 @@ When /^I go from the homepage to edit last voting option page$/ do When "I follow \"#{VotingOption.last.description}\"" When 'I follow "Edit Voting option"' end + +Given /^there is an item with some voting options for current agenda$/ do + agenda = Factory(:agenda) + item = Factory(:agenda_item, :agenda => agenda) + voting_option1 = Factory(:voting_option, :agenda_item => item) + voting_option2 = Factory(:voting_option, :agenda_item => item, :description => 'Another choice') +end + +Then /^I should see my vote$/ do + option = VotingOption.first + Then "I should see \"#{option.description}\"" + Then "I should see \"#{option.community_votes}\"" + Then "I should see \"You voted for #{option.description}\" in the notices" +end + +Given /^some community and council votes for a newer item$/ do + agenda = Agenda.current + item = Factory(:agenda_item, :agenda => agenda) + option1 = Factory(:voting_option, :agenda_item => item) + option2 = Factory(:voting_option, :agenda_item => item, :description => 'another option') + option3 = Factory(:voting_option, :agenda_item => item, :description => 'yet another option') + Factory(:vote, :voting_option => option1) + Factory(:vote, :voting_option => option2) + Factory(:vote, :voting_option => option2) + Factory(:vote, :voting_option => option3) + Factory(:vote, :voting_option => option3) + Factory(:vote, :voting_option => option3) +end + +Then /^I should see correct community votes$/ do + Then 'I should see "Community votes: 1 of 6 (17%) votes. "' + Then 'I should see "Community votes: 2 of 6 (33%) votes. "' + Then 'I should see "Community votes: 3 of 6 (50%) votes. "' +end |