Allow creating budgets step by step
We introduce the first step (creating the budget). Co-Authored-By: decabeza <alberto@decabeza.es>
This commit is contained in:
committed by
Javi Martín
parent
82e8de094b
commit
2115eb5274
@@ -84,88 +84,6 @@ describe "Admin budgets", :admin do
|
||||
end
|
||||
end
|
||||
|
||||
context "New" do
|
||||
scenario "Create budget - Knapsack voting (default)" do
|
||||
visit admin_budgets_path
|
||||
click_link "Create new budget"
|
||||
|
||||
fill_in "Name", with: "M30 - Summer campaign"
|
||||
select "Accepting projects", from: "budget[phase]"
|
||||
|
||||
click_button "Create Budget"
|
||||
|
||||
expect(page).to have_content "New participatory budget created successfully!"
|
||||
expect(page).to have_field "Name", with: "M30 - Summer campaign"
|
||||
expect(page).to have_select "Final voting style", selected: "Knapsack"
|
||||
end
|
||||
|
||||
scenario "Create budget - Approval voting" do
|
||||
admin = Administrator.first
|
||||
|
||||
visit admin_budgets_path
|
||||
click_link "Create new budget"
|
||||
|
||||
fill_in "Name", with: "M30 - Summer campaign"
|
||||
select "Accepting projects", from: "budget[phase]"
|
||||
select "Approval", from: "Final voting style"
|
||||
click_button "Create Budget"
|
||||
|
||||
expect(page).to have_content "New participatory budget created successfully!"
|
||||
expect(page).to have_field "Name", with: "M30 - Summer campaign"
|
||||
expect(page).to have_select "Final voting style", selected: "Approval"
|
||||
|
||||
click_link "Select administrators"
|
||||
|
||||
expect(page).to have_field admin.name
|
||||
end
|
||||
|
||||
scenario "Name is mandatory" do
|
||||
visit new_admin_budget_path
|
||||
click_button "Create Budget"
|
||||
|
||||
expect(page).not_to have_content "New participatory budget created successfully!"
|
||||
expect(page).to have_css(".is-invalid-label", text: "Name")
|
||||
end
|
||||
|
||||
scenario "Name should be unique" do
|
||||
create(:budget, name: "Existing Name")
|
||||
|
||||
visit new_admin_budget_path
|
||||
fill_in "Name", with: "Existing Name"
|
||||
click_button "Create Budget"
|
||||
|
||||
expect(page).not_to have_content "New participatory budget created successfully!"
|
||||
expect(page).to have_css(".is-invalid-label", text: "Name")
|
||||
expect(page).to have_css("small.form-error", text: "has already been taken")
|
||||
end
|
||||
|
||||
scenario "Do not show results and stats settings on new budget" do
|
||||
visit new_admin_budget_path
|
||||
|
||||
expect(page).not_to have_content "Show results and stats"
|
||||
expect(page).not_to have_field "Show results"
|
||||
expect(page).not_to have_field "Show stats"
|
||||
expect(page).not_to have_field "Show advanced stats"
|
||||
end
|
||||
end
|
||||
|
||||
context "Create" do
|
||||
scenario "A new budget is always created in draft mode" do
|
||||
visit admin_budgets_path
|
||||
click_link "Create new budget"
|
||||
|
||||
fill_in "Name", with: "M30 - Summer campaign"
|
||||
select "Accepting projects", from: "budget[phase]"
|
||||
|
||||
click_button "Create Budget"
|
||||
|
||||
expect(page).to have_content "New participatory budget created successfully!"
|
||||
expect(page).to have_content "This participatory budget is in draft mode"
|
||||
expect(page).to have_link "Preview budget"
|
||||
expect(page).to have_link "Publish budget"
|
||||
end
|
||||
end
|
||||
|
||||
context "Publish" do
|
||||
let(:budget) { create(:budget, :drafting) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user