Skip to content

Commit

Permalink
Date of promoted comment to answer adjusted (publiclab#2229)
Browse files Browse the repository at this point in the history
* time change , mailer remove and test update

* comments addition in test
  • Loading branch information
grvsachdeva authored and jywarren committed Feb 5, 2018
1 parent 932e965 commit ac4e6c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app/controllers/comment_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ def make_answer
@answer = Answer.new(
nid: @comment.nid,
uid: @comment.uid,
content: @comment.comment
content: @comment.comment,
created_at: @comment.created_at,
updated_at: @comment.created_at
)

if @answer.save && @comment.delete
@answer.answer_notify(current_user)
@answer_id = @comment.aid
respond_with do |format|
format.js { render template: 'comment/make_answer' }
Expand Down
6 changes: 3 additions & 3 deletions test/functional/comment_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def teardown
id: comment.id
end
assert_not_nil :answer
assert_not_equal initial_mail_count, ActionMailer::Base.deliveries.size
assert_equal initial_mail_count, ActionMailer::Base.deliveries.size # check for ensuring that no Email is sent
end

test 'should create answer while promoting comment if user is moderator' do
Expand All @@ -327,7 +327,7 @@ def teardown
id: comment.id
end
assert_not_nil :answer
assert_not_equal initial_mail_count, ActionMailer::Base.deliveries.size
assert_equal initial_mail_count, ActionMailer::Base.deliveries.size # check for ensuring that no Email is sent
end

test 'should create answer while promoting comment if user is admin' do
Expand All @@ -339,7 +339,7 @@ def teardown
id: comment.id
end
assert_not_nil :answer
assert_not_equal initial_mail_count, ActionMailer::Base.deliveries.size
assert_equal initial_mail_count, ActionMailer::Base.deliveries.size # check for ensuring that no Email is sent
end

test 'render propose title template when author is logged in' do
Expand Down

0 comments on commit ac4e6c9

Please sign in to comment.