aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-07-07 11:10:38 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-07-08 20:35:14 +0200
commit7555e5cab5e17f44a6079fc3fbbfa97671450684 (patch)
tree8226defb808be8d1e866800b3a8b49811148bbb4 /features
parentImproved rake tasks (diff)
downloadrecruiting-webapp-7555e5cab5e17f44a6079fc3fbbfa97671450684.tar.gz
recruiting-webapp-7555e5cab5e17f44a6079fc3fbbfa97671450684.tar.bz2
recruiting-webapp-7555e5cab5e17f44a6079fc3fbbfa97671450684.zip
Allow users to suggest questions
Diffstat (limited to 'features')
-rw-r--r--features/step_definitions/users_steps.rb15
-rw-r--r--features/suggest_questions.feature33
-rw-r--r--features/support/paths.rb12
3 files changed, 60 insertions, 0 deletions
diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb
index 7bc1a4d..5d0f4f5 100644
--- a/features/step_definitions/users_steps.rb
+++ b/features/step_definitions/users_steps.rb
@@ -64,3 +64,18 @@ Given /^I am logged in as "([^\"]*)" who is "([^\"]*)"$/ do |login, role|
Given "user \"#{login}\" who is \"#{role}\""
Given "I am logged in as \"#{login}\""
end
+
+Given /^I am logged in as administrator$/ do
+ Given "user \"admin\" who is \"recruiter\""
+ @user.administrator = true
+ @user.save!
+ Given "I am logged in as \"admin\""
+end
+
+Given /^"([^"]*)" suggested question "([^"]*)"$/ do |user, question|
+ Given "user \"#{user}\""
+ Given "a question \"#{question}\""
+ @question.user = @user
+ @question.approved = false
+ @question.save!
+end
diff --git a/features/suggest_questions.feature b/features/suggest_questions.feature
new file mode 100644
index 0000000..6ca8ded
--- /dev/null
+++ b/features/suggest_questions.feature
@@ -0,0 +1,33 @@
+Feature: Suggest Questions
+ As a recruiters lead
+ I want everyone logged in to be able to suggest new questions
+ So that our question battery improves easily
+
+ Scenario: Suggest Question
+ Given I am logged in as "recruit"
+ And I am on the home page
+ When I follow "Suggestion Questions" within ".navigation.main-nav"
+ And I follow "New question"
+ And I fill in "question[content]" with "Some question"
+ And I fill in "question[title]" with "Some question"
+ And press "Create Question"
+ And I should see "The question was created successfully" within ".flash.notice"
+ And I should see "Not approved."
+
+ Scenario: Approving Questions
+ Given "recruit" suggested question "question"
+ And a question "some question"
+ And I am logged in as administrator
+ When I follow "Approve Questions" within ".navigation.main-nav"
+ Then I should see "question" within ".collection.questions"
+ And I should not see "some question" within ".collection.questions"
+ When I follow "question"
+ And follow "(Edit)"
+ And check "question[approved]"
+ And press "Save"
+ Then I should see "Changes to the question were saved" within ".flash.notice"
+ And I should not see "Not approved."
+
+ Scenario: No questions to approve
+ Given I am logged in as administrator
+ Then I should not see "Approve Questions"
diff --git a/features/support/paths.rb b/features/support/paths.rb
index 0f57fa1..16424c7 100644
--- a/features/support/paths.rb
+++ b/features/support/paths.rb
@@ -37,6 +37,18 @@ module NavigationHelpers
when /project acceptance of "([^\"]*)" by "([^\"]*)" edit page/
edit_project_acceptance_path(ProjectAcceptance.find_by_user_name_and_accepting_nick($1, $2))
+
+ when /all my questions page/
+ my_questions_questions_path
+
+ when /my answered questions page/
+ answered_questions_questions_path
+
+ when /my unanswered questions page/
+ unanswered_questions_questions_path
+
+ when /questions index page/
+ questions_path
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#