aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'features')
-rw-r--r--features/answer_text_question.feature14
-rw-r--r--features/multiple_choice_questions.feature30
-rw-r--r--features/prohibit_viewing_some_pages.feature8
-rw-r--r--features/step_definitions/answer_text_question_steps.rb4
-rw-r--r--features/step_definitions/multiple_choice_question_steps.rb25
-rw-r--r--features/step_definitions/prohibit_viewing_some_pages_steps.rb4
-rw-r--r--features/step_definitions/questions_steps.rb2
-rw-r--r--features/suggest_questions.feature1
-rw-r--r--features/support/paths.rb3
9 files changed, 89 insertions, 2 deletions
diff --git a/features/answer_text_question.feature b/features/answer_text_question.feature
new file mode 100644
index 0000000..a8d6186
--- /dev/null
+++ b/features/answer_text_question.feature
@@ -0,0 +1,14 @@
+Feature: Answering text question
+ As recruit
+ I should be able to answer text question
+ So my knowledge can be evaluated properly
+
+ Scenario: Answer text question
+ Given I am logged in as "recruit"
+ And a question "question" in category "category"
+ And text content "some question" for question "question"
+ When I am on show "question" question page
+ And I follow "Answer it!"
+ And fill in "answer[content]" with "my answer"
+ And I press "Create Answer"
+ Then I should see "The answer was created successfully" within ".flash.notice"
diff --git a/features/multiple_choice_questions.feature b/features/multiple_choice_questions.feature
new file mode 100644
index 0000000..b88641f
--- /dev/null
+++ b/features/multiple_choice_questions.feature
@@ -0,0 +1,30 @@
+Feature: Multiple Choice
+ As a recruiting lead
+ I want the webapp to support multiple choice questions
+ So that recruits get instant feedback
+
+ Scenario: Creating Multiple Choice Questions
+ Given I am logged in as administrator
+ And a question "question"
+ And I am on show "question" question page
+ When I follow "Add multiple choice content"
+ And fill in "question_content_multiple_choice[content]" with "Some question?"
+ And fill in "question_content_multiple_choice[options]" with "Option 2"
+ And press "Create Question Content Multiple Choice"
+ Then I should see "The question content multiple choice was created successfully" within ".flash.notice"
+
+ Scenario: Answer multiple choice Question
+ Given following options for "question":
+ |Option 1|Option 2|Option 3|
+ And I am logged in as "recruit"
+ When I am on show "question" question page
+ And follow "Answer it!"
+ Then I should see following:
+ |Option 1|Option 2|Option 3|
+ When I check "Option 2"
+ And press "Create Answer"
+ Then I should see "The multiple choice answer was created successfully" within ".flash.notice"
+ When I am on answer of "recruit" for question "question" page
+ Then the "Option 2" checkbox should be checked
+ And the "Option 1" checkbox should not be checked
+ And the "Option 3" checkbox should not be checked
diff --git a/features/prohibit_viewing_some_pages.feature b/features/prohibit_viewing_some_pages.feature
new file mode 100644
index 0000000..7ee56b7
--- /dev/null
+++ b/features/prohibit_viewing_some_pages.feature
@@ -0,0 +1,8 @@
+Feature: Prohibit seeing some pages
+ As recruiting lead
+ I want to prohibit users from seeing some pages
+ So they don't access information they are not supposed to
+
+ Scenario: Hide grouped questions from guest
+ Given a question "question" in group "group"
+ Then I should be prohibited to visit show "question" question page
diff --git a/features/step_definitions/answer_text_question_steps.rb b/features/step_definitions/answer_text_question_steps.rb
new file mode 100644
index 0000000..3b758bf
--- /dev/null
+++ b/features/step_definitions/answer_text_question_steps.rb
@@ -0,0 +1,4 @@
+Given /^text content "([^"]*)" for question "([^"]*)"$/ do |content, question|
+ Given "a question \"#{question}\""
+ QuestionContentText.create! :question => @question, :content => content
+end
diff --git a/features/step_definitions/multiple_choice_question_steps.rb b/features/step_definitions/multiple_choice_question_steps.rb
new file mode 100644
index 0000000..5a12b34
--- /dev/null
+++ b/features/step_definitions/multiple_choice_question_steps.rb
@@ -0,0 +1,25 @@
+Given /^a multiple choice content "([^\"]*)"$/ do |content|
+ @content = QuestionContentMultipleChoice.find_by_content(content)
+ if @content.nil?
+ @content = QuestionContentMultipleChoice.create! :content => content
+ end
+end
+
+Given /^a multiple choice content "([^\"]*)" for "([^\"]*)"$/ do |content, question|
+ Given "a multiple choice content \"#{content}\""
+ Given "a question \"#{question}\""
+ @content.question = @question
+ @content.save!
+end
+
+Given /^(?:|an )option "([^\"]*)" for "([^\"]*)"$/ do |opt, content|
+ Given "a multiple choice content \"#{content}\""
+ Option.create! :content => opt, :option_owner => @content
+end
+
+Given /^following options for "([^\"]*)":$/ do |question, table|
+ Given "a multiple choice content \"#{question}\" for \"#{question}\""
+ for option in table.raw.flatten
+ Given "option \"#{option}\" for \"#{question}\""
+ end
+end
diff --git a/features/step_definitions/prohibit_viewing_some_pages_steps.rb b/features/step_definitions/prohibit_viewing_some_pages_steps.rb
new file mode 100644
index 0000000..9c01d0d
--- /dev/null
+++ b/features/step_definitions/prohibit_viewing_some_pages_steps.rb
@@ -0,0 +1,4 @@
+Then /^I should be prohibited to visit (.+)/ do |page_name|
+ assert_raise(Hobo::PermissionDeniedError){ visit path_to(page_name) }
+end
+
diff --git a/features/step_definitions/questions_steps.rb b/features/step_definitions/questions_steps.rb
index da57160..7e884bb 100644
--- a/features/step_definitions/questions_steps.rb
+++ b/features/step_definitions/questions_steps.rb
@@ -1,7 +1,7 @@
Given /^a question "([^\"]*)"$/ do |title|
@question = Question.find_by_title(title)
if @question.nil?
- @question = Question.create!( :title => title, :content => "fake")
+ @question = Question.create!( :title => title)
end
end
diff --git a/features/suggest_questions.feature b/features/suggest_questions.feature
index 6ca8ded..22ac498 100644
--- a/features/suggest_questions.feature
+++ b/features/suggest_questions.feature
@@ -8,7 +8,6 @@ Feature: Suggest Questions
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"
diff --git a/features/support/paths.rb b/features/support/paths.rb
index bbc49a8..c6f2aa2 100644
--- a/features/support/paths.rb
+++ b/features/support/paths.rb
@@ -52,6 +52,9 @@ module NavigationHelpers
when /question groups index page/
category_question_groups_path
+
+ when /show "([^\"]*)" question page/
+ question_path(Question.find_by_title($1))
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#