Skip to content

Commit

Permalink
Unify collapse comments specs
Browse files Browse the repository at this point in the history
  • Loading branch information
taitus committed Mar 25, 2024
1 parent 093ad07 commit 8ba16c2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
19 changes: 0 additions & 19 deletions spec/system/comments/debates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,6 @@

it_behaves_like "flaggable", :debate_comment

scenario "can collapse comments after adding a reply" do
create(:comment, body: "Main comment", commentable: debate)

login_as(user)
visit debate_path(debate)

within ".comment", text: "Main comment" do
first(:link, "Reply").click
fill_in "Leave your comment", with: "It will be done next week."
click_button "Publish reply"

expect(page).to have_content("It will be done next week.")

click_link text: "1 response (collapse)"

expect(page).not_to have_content("It will be done next week.")
end
end

describe "Hide" do
scenario "Without replies" do
create(:comment, commentable: debate, user: user, body: "This was a mistake")
Expand Down
19 changes: 19 additions & 0 deletions spec/system/comments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,25 @@
expect(page).not_to have_content grandchild_comment.body
end

scenario "can collapse comments after adding a reply" do
create(:comment, body: "Main comment", commentable: resource)

login_as(user)
visit polymorphic_path(resource)

within ".comment", text: "Main comment" do
first(:link, "Reply").click
fill_in fill_text, with: "It will be done next week."
click_button "Publish reply"

expect(page).to have_content("It will be done next week.")

click_link text: "1 response (collapse)"

expect(page).not_to have_content("It will be done next week.")
end
end

describe "Not logged user" do
scenario "can not see comments forms" do
create(:comment, commentable: resource)
Expand Down

0 comments on commit 8ba16c2

Please sign in to comment.