As mentioned in commits likea586ba806,a7664ad81,006128da5,b41fbfa52andc480cdd91, accessing the database after starting the browser with the `visit` method sometimes results in database corruption and failing tests on our CI due to the process running the test accessing the database after the process running the browser has started. In this case, we're avoiding the usage of `user.subscriptions_token` and `Comment.last`. In the future, we should probably simplify these tests by moving most of the checks to a mailer test.
15 lines
381 B
Ruby
15 lines
381 B
Ruby
module Comments
|
|
def reply_to(comment, with: "I like what you say", 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: with
|
|
click_button "Publish reply"
|
|
end
|
|
expect(page).to have_content with
|
|
end
|
|
end
|