aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-06-30 16:43:15 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-07-06 16:49:52 +0200
commitef70c52fea7c44b08ee7bec9a1657403cf47d283 (patch)
tree1488cab5a968c9408e32a4e2346f2dbc5032ec65 /site/features
parentDistinguish votes made during council voting and community voice (diff)
downloadcouncil-webapp-ef70c52fea7c44b08ee7bec9a1657403cf47d283.tar.gz
council-webapp-ef70c52fea7c44b08ee7bec9a1657403cf47d283.tar.bz2
council-webapp-ef70c52fea7c44b08ee7bec9a1657403cf47d283.zip
Show community votes properly
Diffstat (limited to 'site/features')
-rw-r--r--site/features/step_definitions/voting_steps.rb34
-rw-r--r--site/features/support/paths.rb2
-rw-r--r--site/features/voting.feature13
3 files changed, 48 insertions, 1 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
diff --git a/site/features/support/paths.rb b/site/features/support/paths.rb
index 0dc1576..e08acc5 100644
--- a/site/features/support/paths.rb
+++ b/site/features/support/paths.rb
@@ -36,7 +36,7 @@ module NavigationHelpers
agenda_path(Agenda.find $1)
when /newest agenda item page/
- agenda_item_path(AgendaItem.first)
+ agenda_item_path(AgendaItem.last)
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
diff --git a/site/features/voting.feature b/site/features/voting.feature
index 2e25318..febb16a 100644
--- a/site/features/voting.feature
+++ b/site/features/voting.feature
@@ -21,3 +21,16 @@ Feature: Application side of voting
And I fill in "voting_option_description" with "some description"
And I press "Save Voting option"
Then I should see "some description" as voting option description
+
+ Scenario: Vote as regular user
+ Given I am logged in as example user
+ And there is an item with some voting options for current agenda
+ When I am on the newest agenda item page
+ And I follow "Vote"
+ Then I should see my vote
+
+ Scenario: View community vote results
+ Given there is an item with some voting options for current agenda
+ And some community and council votes for a newer item
+ When I am on the newest agenda item page
+ Then I should see correct community votes