aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'features/step_definitions')
-rw-r--r--features/step_definitions/agenda_steps.rb15
-rw-r--r--features/step_definitions/user_steps.rb12
2 files changed, 27 insertions, 0 deletions
diff --git a/features/step_definitions/agenda_steps.rb b/features/step_definitions/agenda_steps.rb
new file mode 100644
index 0000000..94a6248
--- /dev/null
+++ b/features/step_definitions/agenda_steps.rb
@@ -0,0 +1,15 @@
+# agenda creation testing is already covered in other steps.
+# let's speed up the test by directly modifying the Model
+Given /^agenda "([^\"]*)" exists$/ do |agenda_name|
+ @agenda = agendas(:agenda_one)
+ if @agenda.name != agenda_name
+ @agenda.update_attributes(:name => agenda_name)
+ end
+end
+
+# avoid repetition in agenda.features
+Given /^I visit agendas as a (.+)$/ do |user|
+ Given "I am logged in as a #{user}"
+ And 'I am on the home page'
+ When 'I follow "Agendas"'
+end
diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb
new file mode 100644
index 0000000..1b4c321
--- /dev/null
+++ b/features/step_definitions/user_steps.rb
@@ -0,0 +1,12 @@
+Given /^I am a visitor$/ do
+ When 'I am on the home page'
+ Then 'I should not see "Logged in as"'
+end
+
+Given /^I am logged in as a (.+)$/ do |user|
+ @user = login_as(user.gsub(/\s/, '_').to_sym)
+ visit user_login_path
+ When %Q{I fill in "login" with "#{@user.email_address}"}
+ And 'I fill in "password" with "kktest3"'
+ And 'I press "Log in"'
+end