aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'site/features/step_definitions')
-rw-r--r--site/features/step_definitions/poll_steps.rb22
-rw-r--r--site/features/step_definitions/voting_steps.rb2
2 files changed, 24 insertions, 0 deletions
diff --git a/site/features/step_definitions/poll_steps.rb b/site/features/step_definitions/poll_steps.rb
new file mode 100644
index 0000000..86a80ca
--- /dev/null
+++ b/site/features/step_definitions/poll_steps.rb
@@ -0,0 +1,22 @@
+Then /^I should see suggested meeting times$/ do
+ descriptions = Agenda.current.agenda_items.first.voting_options.*.description
+ descriptions.each do |description|
+ Then "I should see \"#{description}\""
+ end
+end
+
+When /^I check some boxes$/ do
+ options = Agenda.current.agenda_items.first.voting_options
+ When "I check \"choice[#{options.first.id}]\""
+ When "I check \"choice[#{options.last.id}]\""
+end
+
+Then /^I should see my times marked$/ do
+ options = Agenda.current.agenda_items.first.voting_options
+ "I should see checked checkbox with name \"#{options.first.id}\""
+ "I should see checked checkbox with name \"#{options.last.id}\""
+end
+
+Then /^I should see checked checkbox with name "([^"]*)"$/ do |name|
+ page.should have_xpath(:xpath, "//input[@type='checkbox'][@name='#{"choice[#{no}]"}'][@checked]")
+end
diff --git a/site/features/step_definitions/voting_steps.rb b/site/features/step_definitions/voting_steps.rb
index cfa1253..3740c0b 100644
--- a/site/features/step_definitions/voting_steps.rb
+++ b/site/features/step_definitions/voting_steps.rb
@@ -38,6 +38,8 @@ end
Given /^there is an item with some voting options for current agenda$/ do
agenda = Factory(:agenda)
+ AgendaItem.destroy_all
+ VotingOption.destroy_all
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')