Unify collapse comments specs
This commit is contained in:
@@ -6,25 +6,6 @@ describe "Commenting debates" do
|
|||||||
|
|
||||||
it_behaves_like "flaggable", :debate_comment
|
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
|
describe "Hide" do
|
||||||
scenario "Without replies" do
|
scenario "Without replies" do
|
||||||
create(:comment, commentable: debate, user: user, body: "This was a mistake")
|
create(:comment, commentable: debate, user: user, body: "This was a mistake")
|
||||||
|
|||||||
@@ -163,6 +163,25 @@ describe "Comments" do
|
|||||||
expect(page).not_to have_content grandchild_comment.body
|
expect(page).not_to have_content grandchild_comment.body
|
||||||
end
|
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
|
describe "Not logged user" do
|
||||||
scenario "can not see comments forms" do
|
scenario "can not see comments forms" do
|
||||||
create(:comment, commentable: resource)
|
create(:comment, commentable: resource)
|
||||||
|
|||||||
Reference in New Issue
Block a user