Unify errors on create comments
This commit is contained in:
@@ -220,15 +220,6 @@ describe "Commenting Budget::Investments" do
|
|||||||
end
|
end
|
||||||
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
|
scenario "Reply" do
|
||||||
citizen = create(:user, username: "Ana")
|
citizen = create(:user, username: "Ana")
|
||||||
manuela = create(:user, username: "Manuela")
|
manuela = create(:user, username: "Manuela")
|
||||||
|
|||||||
@@ -220,15 +220,6 @@ describe "Commenting debates" do
|
|||||||
end
|
end
|
||||||
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
|
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")
|
||||||
|
|||||||
@@ -214,15 +214,6 @@ describe "Commenting legislation questions" do
|
|||||||
end
|
end
|
||||||
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
|
scenario "Reply" do
|
||||||
citizen = create(:user, username: "Ana")
|
citizen = create(:user, username: "Ana")
|
||||||
manuela = create(:user, username: "Manuela")
|
manuela = create(:user, username: "Manuela")
|
||||||
|
|||||||
@@ -209,15 +209,6 @@ describe "Commenting legislation questions" do
|
|||||||
end
|
end
|
||||||
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
|
scenario "Reply" do
|
||||||
citizen = create(:user, username: "Ana")
|
citizen = create(:user, username: "Ana")
|
||||||
manuela = create(:user, :level_two, username: "Manuela")
|
manuela = create(:user, :level_two, username: "Manuela")
|
||||||
|
|||||||
@@ -201,15 +201,6 @@ describe "Commenting polls" do
|
|||||||
end
|
end
|
||||||
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
|
scenario "Reply" do
|
||||||
citizen = create(:user, username: "Ana")
|
citizen = create(:user, username: "Ana")
|
||||||
manuela = create(:user, username: "Manuela")
|
manuela = create(:user, username: "Manuela")
|
||||||
|
|||||||
@@ -206,15 +206,6 @@ describe "Commenting proposals" do
|
|||||||
end
|
end
|
||||||
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
|
scenario "Reply" do
|
||||||
citizen = create(:user, username: "Ana")
|
citizen = create(:user, username: "Ana")
|
||||||
manuela = create(:user, username: "Manuela")
|
manuela = create(:user, username: "Manuela")
|
||||||
|
|||||||
@@ -221,18 +221,6 @@ describe "Commenting topics from proposals" do
|
|||||||
end
|
end
|
||||||
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
|
scenario "Reply" do
|
||||||
community = proposal.community
|
community = proposal.community
|
||||||
topic = create(:topic, community: community)
|
topic = create(:topic, community: community)
|
||||||
@@ -754,18 +742,6 @@ describe "Commenting topics from budget investments" do
|
|||||||
end
|
end
|
||||||
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
|
scenario "Reply" do
|
||||||
community = investment.community
|
community = investment.community
|
||||||
topic = create(:topic, community: community)
|
topic = create(:topic, community: community)
|
||||||
|
|||||||
@@ -14,6 +14,13 @@ describe "Comments" do
|
|||||||
].sample
|
].sample
|
||||||
}
|
}
|
||||||
let(:resource) { create(factory) }
|
let(:resource) { create(factory) }
|
||||||
|
let(:user) do
|
||||||
|
if factory == :legislation_question
|
||||||
|
create(:user, :level_two)
|
||||||
|
else
|
||||||
|
create(:user)
|
||||||
|
end
|
||||||
|
end
|
||||||
let(:fill_text) do
|
let(:fill_text) do
|
||||||
if factory == :legislation_question
|
if factory == :legislation_question
|
||||||
"Leave your answer"
|
"Leave your answer"
|
||||||
@@ -21,6 +28,13 @@ describe "Comments" do
|
|||||||
"Leave your comment"
|
"Leave your comment"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
let(:button_text) do
|
||||||
|
if factory == :legislation_question
|
||||||
|
"Publish answer"
|
||||||
|
else
|
||||||
|
"Publish comment"
|
||||||
|
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
|
||||||
@@ -35,4 +49,13 @@ describe "Comments" do
|
|||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user