Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Allow mentors to update their comments on applications #1176

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/views/mentors/applications/_comment.html.slim
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
ruby:
comment_path = if comment.persisted? then
mentors_comment_path(comment)
else
mentors_comments_path
end

hr(id="#{dom_id comment}")
= simple_form_for comment, url: mentors_comments_path do |f|
= simple_form_for comment, url: comment_path do |f|
.form-inputs.clearfix
= f.input :commentable_id, as: :hidden, value: comment.commentable_id
= f.input :text, as: :text, label: 'My Comment', input_html: { rows: 5 }, hint: 'This is a place for you to take notes for yourself about this application. Your comment is only visible to yourself as well as the selection committee and you can update and remove it as you like.'
Expand Down
27 changes: 27 additions & 0 deletions spec/features/mentors/applications/show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,33 @@
expect(page).to have_button 'Create Comment'
end

it 'lets the mentor create a comment' do
login_as user

visit mentors_application_path(application)

fill_in 'My Comment', with: 'Test Comment'
click_button 'Create Comment'

expect(page).to have_content 'Test Comment'
end

it 'lets the mentor update a comment' do
login_as user

visit mentors_application_path(application)

fill_in 'My Comment', with: 'Test Comment'
click_button 'Create Comment'

expect(page).to have_content 'Test Comment'

fill_in 'My Comment', with: 'Updated Comment'
click_button 'Update Comment'

expect(page).to have_content 'Updated Comment'
end

context 'when the project is 2nd choice' do
let(:application) { create(:application, :in_current_season, :for_project, project2: project, team: team) }

Expand Down