Simplify tests replying to a comment
We were using the `reply_to` method in some places, but not in others.
This commit is contained in:
@@ -51,18 +51,7 @@ shared_examples "notifiable in-app" do |factory_name|
|
||||
scenario "A user replied to my comment" do
|
||||
comment = create(:comment, commentable: notifiable, user: author)
|
||||
|
||||
login_as(create(:user, :verified))
|
||||
visit path_for(notifiable)
|
||||
|
||||
click_link "Reply"
|
||||
within "#js-comment-form-comment_#{comment.id}" do
|
||||
fill_in comment_body(notifiable), with: "I replied to your comment"
|
||||
click_button "Publish reply"
|
||||
end
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content "I replied to your comment"
|
||||
end
|
||||
reply_to(comment, with: "I replied to your comment", replier: create(:user, :verified))
|
||||
|
||||
logout
|
||||
login_as author
|
||||
@@ -120,18 +109,7 @@ shared_examples "notifiable in-app" do |factory_name|
|
||||
scenario "Author replied to his own comment" do
|
||||
comment = create(:comment, commentable: notifiable, user: author)
|
||||
|
||||
login_as author
|
||||
visit path_for(notifiable)
|
||||
|
||||
click_link "Reply"
|
||||
within "#js-comment-form-comment_#{comment.id}" do
|
||||
fill_in comment_body(notifiable), with: "I replied to my own comment"
|
||||
click_button "Publish reply"
|
||||
end
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content "I replied to my own comment"
|
||||
end
|
||||
reply_to(comment, with: "I replied to my own comment", replier: author)
|
||||
|
||||
within("#notifications") do
|
||||
click_link "You don't have new notifications"
|
||||
|
||||
@@ -4,11 +4,17 @@ module Comments
|
||||
|
||||
visit polymorphic_path(comment.commentable)
|
||||
|
||||
click_link "Reply"
|
||||
within "#comment_#{comment.id}" do
|
||||
click_link "Reply"
|
||||
end
|
||||
|
||||
within "#js-comment-form-comment_#{comment.id}" do
|
||||
fill_in "Leave your comment", with: with
|
||||
fill_in comment_body(comment.commentable), with: with
|
||||
click_button "Publish reply"
|
||||
end
|
||||
expect(page).to have_content with
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content with
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -383,21 +383,7 @@ describe "Comments" do
|
||||
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
|
||||
reply_to(comment, with: "It will be done next week.", replier: user)
|
||||
|
||||
expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user