aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-06-23 11:32:26 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-06-24 22:32:32 +0200
commit8922487a577a3258819d9329550efde326b136bc (patch)
tree0e373f0159e44ab30b05d62630966e9510b8e254 /features
parentMentor demoting to recruit (diff)
downloadrecruiting-webapp-8922487a577a3258819d9329550efde326b136bc.tar.gz
recruiting-webapp-8922487a577a3258819d9329550efde326b136bc.tar.bz2
recruiting-webapp-8922487a577a3258819d9329550efde326b136bc.zip
Support for mentor comments
Generated Comment model and CommentsController. Added relation (answer has many comments, comment belongs to answer). Added email notification when new comment is created. This commit includes also schema change and tests.
Diffstat (limited to 'features')
-rw-r--r--features/commenting.feature28
-rw-r--r--features/step_definitions/comments_steps.rb5
-rw-r--r--features/support/paths.rb9
3 files changed, 42 insertions, 0 deletions
diff --git a/features/commenting.feature b/features/commenting.feature
new file mode 100644
index 0000000..578ed63
--- /dev/null
+++ b/features/commenting.feature
@@ -0,0 +1,28 @@
+Feature: Mentor comments for recruit answers
+ As a mentor
+ I want to be able to comment answers of my recruits
+ so they can improve their answers
+
+ Scenario: Go to add comment page from answer page
+ Given user "mentor" is mentor of "recruit"
+ And answer of "recruit" for question "example question"
+ And I am logged in as "mentor"
+ And I am on answer of "recruit" for question "example question" page
+ When I follow "Comment this answer"
+ Then I should be on new comment for answer of "recruit" for question "example question"
+
+ Scenario: Add comment
+ Given user "mentor" is mentor of "recruit"
+ And answer of "recruit" for question "example question"
+ And I am logged in as "mentor"
+ And I am on new comment for answer of "recruit" for question "example question"
+ When I fill in "comment_content" with "some comment"
+ And press "Create Comment"
+ Then I should be on newest comment page
+ And I should see "some comment"
+
+ Scenario: View comment on answer page
+ Given a comment "example comment" of "mentor" for answer of "recruit" for question "example question"
+ And I am logged in as "recruit"
+ And I am on answer of "recruit" for question "example question" page
+ Then I should see "example comment"
diff --git a/features/step_definitions/comments_steps.rb b/features/step_definitions/comments_steps.rb
new file mode 100644
index 0000000..1f6d158
--- /dev/null
+++ b/features/step_definitions/comments_steps.rb
@@ -0,0 +1,5 @@
+Given /^(?:|a )comment "([^\"]*)" of "([^\"]*)" for answer of "([^\"]*)" for question "([^\"]*)"$/ do |comment, mentor, user, question|
+ Given "user \"#{mentor}\" is mentor of \"#{user}\""
+ Given "answer of \"#{user}\" for question \"#{question}\""
+ Comment.create! :owner => @mentor, :answer => @answer, :content => comment
+end
diff --git a/features/support/paths.rb b/features/support/paths.rb
index e8d8a09..3d34dd6 100644
--- a/features/support/paths.rb
+++ b/features/support/paths.rb
@@ -22,6 +22,15 @@ module NavigationHelpers
when /unanswered questions page/
unanswered_questions_questions_path
+
+ when /answer of "([^\"]*)" for question "([^\"]*)" page/
+ answer_path(Question.find_by_title($2).answer_of(User.find_by_name($1)))
+
+ when /new comment for answer of "([^\"]*)" for question "([^\"]*)"/
+ new_comment_for_answer_path(Question.find_by_title($2).answer_of(User.find_by_name($1)))
+
+ when /newest comment page/
+ comment_path(Comment.last)
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#