Unify errors on create comments

This commit is contained in:
taitus
2023-12-13 14:39:55 +01:00
parent 0f2f79ba99
commit a5e4fb13b4
8 changed files with 23 additions and 78 deletions

View File

@@ -220,15 +220,6 @@ describe "Commenting Budget::Investments" do
end
end
scenario "Errors on create" do
login_as(user)
visit budget_investment_path(investment.budget, investment)
click_button "Publish comment"
expect(page).to have_content "Can't be blank"
end
scenario "Reply" do
citizen = create(:user, username: "Ana")
manuela = create(:user, username: "Manuela")

View File

@@ -220,15 +220,6 @@ describe "Commenting debates" do
end
end
scenario "Errors on create" do
login_as(user)
visit debate_path(debate)
click_button "Publish comment"
expect(page).to have_content "Can't be blank"
end
describe "Hide" do
scenario "Without replies" do
create(:comment, commentable: debate, user: user, body: "This was a mistake")

View File

@@ -214,15 +214,6 @@ describe "Commenting legislation questions" do
end
end
scenario "Errors on create" do
login_as(user)
visit polymorphic_path(annotation)
click_button "Publish comment"
expect(page).to have_content "Can't be blank"
end
scenario "Reply" do
citizen = create(:user, username: "Ana")
manuela = create(:user, username: "Manuela")

View File

@@ -209,15 +209,6 @@ describe "Commenting legislation questions" do
end
end
scenario "Errors on create" do
login_as(user)
visit legislation_process_question_path(question.process, question)
click_button "Publish answer"
expect(page).to have_content "Can't be blank"
end
scenario "Reply" do
citizen = create(:user, username: "Ana")
manuela = create(:user, :level_two, username: "Manuela")

View File

@@ -201,15 +201,6 @@ describe "Commenting polls" do
end
end
scenario "Errors on create" do
login_as(user)
visit poll_path(poll)
click_button "Publish comment"
expect(page).to have_content "Can't be blank"
end
scenario "Reply" do
citizen = create(:user, username: "Ana")
manuela = create(:user, username: "Manuela")

View File

@@ -206,15 +206,6 @@ describe "Commenting proposals" do
end
end
scenario "Errors on create" do
login_as(user)
visit proposal_path(proposal)
click_button "Publish comment"
expect(page).to have_content "Can't be blank"
end
scenario "Reply" do
citizen = create(:user, username: "Ana")
manuela = create(:user, username: "Manuela")

View File

@@ -221,18 +221,6 @@ describe "Commenting topics from proposals" do
end
end
scenario "Errors on create" do
community = proposal.community
topic = create(:topic, community: community)
login_as(user)
visit community_topic_path(community, topic)
click_button "Publish comment"
expect(page).to have_content "Can't be blank"
end
scenario "Reply" do
community = proposal.community
topic = create(:topic, community: community)
@@ -754,18 +742,6 @@ describe "Commenting topics from budget investments" do
end
end
scenario "Errors on create" do
community = investment.community
topic = create(:topic, community: community)
login_as(user)
visit community_topic_path(community, topic)
click_button "Publish comment"
expect(page).to have_content "Can't be blank"
end
scenario "Reply" do
community = investment.community
topic = create(:topic, community: community)

View File

@@ -14,6 +14,13 @@ describe "Comments" do
].sample
}
let(:resource) { create(factory) }
let(:user) do
if factory == :legislation_question
create(:user, :level_two)
else
create(:user)
end
end
let(:fill_text) do
if factory == :legislation_question
"Leave your answer"
@@ -21,6 +28,13 @@ describe "Comments" do
"Leave your comment"
end
end
let(:button_text) do
if factory == :legislation_question
"Publish answer"
else
"Publish comment"
end
end
describe "Not logged user" do
scenario "can not see comments forms" do
@@ -35,4 +49,13 @@ describe "Comments" do
end
end
end
scenario "Errors on create" do
login_as(user)
visit polymorphic_path(resource)
click_button button_text
expect(page).to have_content "Can't be blank"
end
end