diff options
-rw-r--r-- | app/views/users/show.dryml | 12 | ||||
-rw-r--r-- | features/request_mentor.feature | 13 |
2 files changed, 21 insertions, 4 deletions
diff --git a/app/views/users/show.dryml b/app/views/users/show.dryml index 3cd38d1..b7bd5fe 100644 --- a/app/views/users/show.dryml +++ b/app/views/users/show.dryml @@ -14,5 +14,17 @@ <field-list: skip="user, accepting_nick, accepted"/> <actions:><submit label="This recruit needs your acceptance"/></actions:> </form> + + <if test="&this.editable_by?(current_user, :mentor)"> + <form if="&this.mentor.nil?"> + <input value="¤t_user.id" type="hidden" name="user[mentor_id]"/> + <submit label="Start mentoring this recruit"/> + </form> + + <form if="&this.mentor_is?(current_user)"> + <input value="" type="hidden" name="user[mentor_id]"/> + <submit label="Stop mentoring this recruit"/> + </form> + </if> </append-aside:> </show-page> diff --git a/features/request_mentor.feature b/features/request_mentor.feature index 01e550e..1e5631f 100644 --- a/features/request_mentor.feature +++ b/features/request_mentor.feature @@ -22,10 +22,15 @@ Feature: Request Mentor And I should see "recruit1" within ".collection.users" But I should not see "recruit3" within ".collection.users" - Scenario: Become mentor of mentorless recruit + Scenario: Become mentor of mentorless recruit then stop mentoring Given I am logged in as "mentor" who is "mentor" And user "recruit" who is "recruit" - And I am on edit "recruit" user page - When I select "mentor" from "user[mentor_id]" - And press "Save" + And I am on show "recruit" user page + When I press "Start mentoring this recruit" + Then I should see "Changes to the user were saved" within ".flash.notice" + And I should see "Mentor mentor" + + And I am on show "recruit" user page + When I press "Stop mentoring this recruit" Then I should see "Changes to the user were saved" within ".flash.notice" + And I should see "Mentor (Not Available) " |