These tests don't use the browser to send emails since commit e21588ec1.
However, note that this commit actually actually decreased our test
coverage somehow; since then, we're no longer testing whether we send an
email to the author after clicking the "Publish comment" button. We
might need to add a test for this in the `spec/system/comments_spec.rb`
file... but that's a story for another time.
Note we need to stub the `deliver_later` method; otherwise,
`open_last_email` would raise an exception since no email would have
been delivered.
We're moving them now because these tests use the `open_last_email`
method, and we're looking for places where using this method might
result in a flaky test when used inside a system test.
15 lines
400 B
Ruby
15 lines
400 B
Ruby
module Comments
|
|
def reply_to(comment, replier: create(:user))
|
|
login_as(replier)
|
|
|
|
visit polymorphic_path(comment.commentable)
|
|
|
|
click_link "Reply"
|
|
within "#js-comment-form-comment_#{comment.id}" do
|
|
fill_in "Leave your comment", with: "It will be done next week."
|
|
click_button "Publish reply"
|
|
end
|
|
expect(page).to have_content "It will be done next week."
|
|
end
|
|
end
|