Unify reply comments specs
Note that the click_link "Reply" is now inside a "within". This is due to the case of "legislation_annotation" before in the original test no comment was created as it simply took the one created by default when creating a "legislation_annotation". ``` annotation = create(:legislation_annotation, author: citizen) comment = annotation.comments.first ``` Now to try to unify this test, we always create a comment, and in this case as we also created the "legislation_annotation" we have 2 comments, so it is necessary to add the "click_link" inside the "within".
This commit is contained in:
@@ -306,6 +306,28 @@ describe "Comments" do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Reply" do
|
||||
comment = create(:comment, commentable: resource)
|
||||
|
||||
login_as(user)
|
||||
visit polymorphic_path(resource)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
click_link "Reply"
|
||||
end
|
||||
|
||||
within "#js-comment-form-comment_#{comment.id}" do
|
||||
fill_in fill_text, with: "It will be done next week."
|
||||
click_button "Publish reply"
|
||||
end
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content "It will be done next week."
|
||||
end
|
||||
|
||||
expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}"
|
||||
end
|
||||
|
||||
scenario "Errors on create" do
|
||||
login_as(user)
|
||||
visit polymorphic_path(resource)
|
||||
|
||||
Reference in New Issue
Block a user