Merge pull request #6040 from consuldemocracy/remove-redundant-tests
Remove redundant tests
This commit is contained in:
@@ -2,7 +2,7 @@ require "rails_helper"
|
||||
|
||||
describe "Budgets wizard, first step", :admin do
|
||||
describe "New" do
|
||||
scenario "Create budget - Knapsack voting (default)" do
|
||||
scenario "Create budget with Knapsack voting and in draft mode (default)" do
|
||||
visit admin_budgets_path
|
||||
click_button "Create new budget"
|
||||
click_link "Create multiple headings budget"
|
||||
@@ -10,7 +10,7 @@ describe "Budgets wizard, first step", :admin do
|
||||
fill_in "Name", with: "M30 - Summer campaign"
|
||||
fill_in "Text on the link", with: "Participate now!"
|
||||
fill_in "The link takes you to (add a link)", with: "https://consuldemocracy.org"
|
||||
fill_in "Name", with: "M30 - Summer campaign"
|
||||
|
||||
click_button "Continue to groups"
|
||||
|
||||
expect(page).to have_content "New participatory budget created successfully!"
|
||||
@@ -19,6 +19,13 @@ describe "Budgets wizard, first step", :admin do
|
||||
|
||||
expect(page).to have_field "Name", with: "M30 - Summer campaign"
|
||||
expect(page).to have_select "Final voting style", selected: "Knapsack"
|
||||
|
||||
within("#side_menu") { click_link "Participatory budgets" }
|
||||
within("tr", text: "M30 - Summer campaign") { click_link "Edit" }
|
||||
|
||||
expect(page).to have_content "This participatory budget is in draft mode"
|
||||
expect(page).to have_link "Preview"
|
||||
expect(page).to have_button "Publish budget"
|
||||
end
|
||||
|
||||
scenario "Create budget - Approval voting" do
|
||||
@@ -75,52 +82,16 @@ describe "Budgets wizard, first step", :admin do
|
||||
end
|
||||
end
|
||||
|
||||
describe "Create" do
|
||||
scenario "A new budget is always created in draft mode" do
|
||||
visit admin_budgets_path
|
||||
click_button "Create new budget"
|
||||
click_link "Create multiple headings budget"
|
||||
|
||||
fill_in "Name", with: "M30 - Summer campaign"
|
||||
|
||||
click_button "Continue to groups"
|
||||
|
||||
expect(page).to have_content "New participatory budget created successfully!"
|
||||
|
||||
within("#side_menu") { click_link "Participatory budgets" }
|
||||
within("tr", text: "M30 - Summer campaign") { click_link "Edit" }
|
||||
|
||||
expect(page).to have_content "This participatory budget is in draft mode"
|
||||
expect(page).to have_link "Preview"
|
||||
expect(page).to have_button "Publish budget"
|
||||
end
|
||||
end
|
||||
|
||||
describe "Edit" do
|
||||
scenario "update budget" do
|
||||
scenario "update budget with errors and then without errors" do
|
||||
budget = create(:budget, name: "Budget wiht typo")
|
||||
|
||||
visit admin_budgets_wizard_budget_groups_path(budget)
|
||||
|
||||
click_link "Go back to edit budget"
|
||||
visit edit_admin_budgets_wizard_budget_path(budget)
|
||||
|
||||
expect(page).to have_content "Edit Participatory budget"
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
expect(page).to have_field "Name", with: "Budget wiht typo"
|
||||
|
||||
fill_in "Name", with: "Budget without typos"
|
||||
click_button "Continue to groups"
|
||||
|
||||
expect(page).to have_content "Participatory budget updated successfully"
|
||||
expect(page).to have_content "Budget without typos"
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
expect(page).to have_content "There are no groups"
|
||||
end
|
||||
|
||||
scenario "submit the form with errors and then without errors" do
|
||||
budget = create(:budget, name: "Budget wiht typo")
|
||||
|
||||
visit edit_admin_budgets_wizard_budget_path(budget)
|
||||
fill_in "Name", with: ""
|
||||
click_button "Continue to groups"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ describe "Budgets wizard, groups step", :admin do
|
||||
let(:budget) { create(:budget, :drafting) }
|
||||
|
||||
describe "New" do
|
||||
scenario "create group" do
|
||||
scenario "create group with errors and then without errors" do
|
||||
visit admin_budgets_wizard_budget_groups_path(budget)
|
||||
|
||||
within "#side_menu" do
|
||||
@@ -16,6 +16,17 @@ describe "Budgets wizard, groups step", :admin do
|
||||
|
||||
click_button "Add new group"
|
||||
|
||||
click_button "Create new group"
|
||||
|
||||
expect(page).to have_css ".is-invalid-label", text: "Group name"
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
expect(page).to have_content "can't be blank"
|
||||
expect(page).to have_button "Create new group"
|
||||
expect(page).to have_button "Cancel"
|
||||
expect(page).not_to have_content "Group created successfully!"
|
||||
expect(page).not_to have_button "Add new group"
|
||||
expect(page).not_to have_content "Continue to headings"
|
||||
|
||||
fill_in "Group name", with: "All City"
|
||||
|
||||
click_button "Create new group"
|
||||
@@ -46,26 +57,10 @@ describe "Budgets wizard, groups step", :admin do
|
||||
expect(page).not_to have_button "Cancel"
|
||||
expect(page).to have_content "Continue to headings"
|
||||
end
|
||||
|
||||
scenario "submit the form with errors" do
|
||||
visit admin_budgets_wizard_budget_groups_path(budget)
|
||||
click_button "Add new group"
|
||||
|
||||
click_button "Create new group"
|
||||
|
||||
expect(page).to have_css ".is-invalid-label", text: "Group name"
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
expect(page).to have_content "can't be blank"
|
||||
expect(page).to have_button "Create new group"
|
||||
expect(page).to have_button "Cancel"
|
||||
expect(page).not_to have_content "Group created successfully!"
|
||||
expect(page).not_to have_button "Add new group"
|
||||
expect(page).not_to have_content "Continue to headings"
|
||||
end
|
||||
end
|
||||
|
||||
describe "Edit" do
|
||||
scenario "update group" do
|
||||
scenario "update group with errors and then without errors" do
|
||||
create(:budget_group, budget: budget, name: "Group wiht a typo")
|
||||
|
||||
visit admin_budgets_wizard_budget_groups_path(budget)
|
||||
@@ -73,18 +68,6 @@ describe "Budgets wizard, groups step", :admin do
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
|
||||
within("tr", text: "Group wiht a typo") { click_link "Edit" }
|
||||
fill_in "Group name", with: "Group without typos"
|
||||
click_button "Save group"
|
||||
|
||||
expect(page).to have_content "Group updated successfully"
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
expect(page).to have_css "td", exact_text: "Group without typos"
|
||||
end
|
||||
|
||||
scenario "submit the form with errors and then without errors" do
|
||||
group = create(:budget_group, budget: budget, name: "Group wiht a typo")
|
||||
|
||||
visit edit_admin_budgets_wizard_budget_group_path(budget, group)
|
||||
fill_in "Group name", with: ""
|
||||
click_button "Save group"
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ describe "Budgets wizard, headings step", :admin do
|
||||
end
|
||||
|
||||
describe "Edit" do
|
||||
scenario "update heading" do
|
||||
scenario "update heading with errors and then without errors" do
|
||||
create(:budget_heading, group: group, name: "Heading wiht a typo")
|
||||
|
||||
visit admin_budgets_wizard_budget_group_headings_path(budget, group)
|
||||
@@ -97,18 +97,6 @@ describe "Budgets wizard, headings step", :admin do
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
|
||||
within("tr", text: "Heading wiht a typo") { click_link "Edit" }
|
||||
fill_in "Heading name", with: "Heading without typos"
|
||||
click_button "Save heading"
|
||||
|
||||
expect(page).to have_content "Heading updated successfully"
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
expect(page).to have_css "td", exact_text: "Heading without typos"
|
||||
end
|
||||
|
||||
scenario "submit the form with errors and then without errors" do
|
||||
heading = create(:budget_heading, group: group, name: "Heading wiht a typo")
|
||||
|
||||
visit edit_admin_budgets_wizard_budget_group_heading_path(budget, group, heading)
|
||||
fill_in "Heading name", with: ""
|
||||
click_button "Save heading"
|
||||
|
||||
|
||||
@@ -64,21 +64,7 @@ describe "Budgets wizard, phases step", :admin do
|
||||
end
|
||||
|
||||
describe "Edit" do
|
||||
scenario "update phase" do
|
||||
visit admin_budgets_wizard_budget_budget_phases_path(budget)
|
||||
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
|
||||
within("tr", text: "Selecting projects") { click_link "Edit" }
|
||||
fill_in "Name", with: "Choosing projects"
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content "Changes saved"
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
within_table("Phases") { expect(page).to have_content "Choosing projects" }
|
||||
end
|
||||
|
||||
scenario "submit the form with errors and then without errors" do
|
||||
scenario "update phase with errors and then without errors" do
|
||||
phase = budget.phases.accepting
|
||||
|
||||
visit edit_admin_budgets_wizard_budget_budget_phase_path(budget, phase)
|
||||
@@ -88,17 +74,19 @@ describe "Budgets wizard, phases step", :admin do
|
||||
expect(page).to have_css "#error_explanation"
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
|
||||
fill_in "Name", with: "Welcoming projects"
|
||||
fill_in "Name", with: "Choosing projects"
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content "Changes saved"
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
within_table("Phases") { expect(page).to have_content "Welcoming projects" }
|
||||
within_table("Phases") { expect(page).to have_content "Choosing projects" }
|
||||
end
|
||||
|
||||
scenario "update phase in single heading budget" do
|
||||
visit admin_budgets_wizard_budget_budget_phases_path(budget, mode: "single")
|
||||
|
||||
expect(page).to have_css ".creation-timeline"
|
||||
|
||||
within("tr", text: "Selecting projects") { click_link "Edit" }
|
||||
fill_in "Name", with: "Choosing projects"
|
||||
click_button "Save changes"
|
||||
|
||||
@@ -2,13 +2,16 @@ require "rails_helper"
|
||||
|
||||
describe "Proposal Notifications" do
|
||||
scenario "Send a notification" do
|
||||
author = create(:user, :with_proposal)
|
||||
author = create(:user)
|
||||
proposal = create(:proposal, author: author)
|
||||
|
||||
login_as(author)
|
||||
visit root_path
|
||||
|
||||
click_link "My content"
|
||||
click_link "Dashboard"
|
||||
within("#proposal_#{proposal.id}") do
|
||||
click_link "Dashboard"
|
||||
end
|
||||
|
||||
within("#side_menu") do
|
||||
click_link "Message to users"
|
||||
@@ -142,26 +145,6 @@ describe "Proposal Notifications" do
|
||||
end
|
||||
|
||||
context "Permissions" do
|
||||
scenario "Link to send the message" do
|
||||
author = create(:user)
|
||||
proposal = create(:proposal, author: author)
|
||||
|
||||
login_as(author)
|
||||
visit root_path
|
||||
|
||||
click_link "My content"
|
||||
|
||||
within("#proposal_#{proposal.id}") do
|
||||
click_link "Dashboard"
|
||||
end
|
||||
|
||||
within("#side_menu") do
|
||||
click_link "Message to users"
|
||||
end
|
||||
|
||||
expect(page).to have_link "Send notification to proposal followers"
|
||||
end
|
||||
|
||||
scenario "Accessing form directly" do
|
||||
user = create(:user)
|
||||
author = create(:user)
|
||||
|
||||
Reference in New Issue
Block a user