Files
grecia/spec/controllers/admin/budget_groups_controller_spec.rb
Julian Herrero 2b709f1a36 Groups and headings CRUD from budget view
Before, users needed to navigate to the list of groups in order to
add, edit or delete a group.

Also, they need to navigate to the list of groups first, and then to
the list of headings for that group in order to add, edit or delete a
heading.

Now, it's possible to do all these actions for any group or heading
from the participatory budget view to bring simplicity and to reduce
the number of clicks from a user perspective.

Co-Authored-By: Javi Martín <javim@elretirao.net>
2021-10-25 18:01:47 +02:00

42 lines
1.2 KiB
Ruby

require "rails_helper"
describe Admin::BudgetGroupsController, :admin do
describe "GET new" do
it "raises an exception when the feature is disabled" do
Setting["process.budgets"] = false
expect do
get :new, params: { budget_id: create(:budget).id }
end.to raise_exception(FeatureFlags::FeatureDisabled)
end
end
describe "GET edit" do
let(:group) { create(:budget_group) }
it "raises an error if budget slug is not found" do
expect do
get :edit, params: { budget_id: "wrong_budget", id: group.id }
end.to raise_error ActiveRecord::RecordNotFound
end
it "raises an error if budget id is not found" do
expect do
get :edit, params: { budget_id: 0, id: group.id }
end.to raise_error ActiveRecord::RecordNotFound
end
it "raises an error if group slug is not found" do
expect do
get :edit, params: { budget_id: group.budget.id, id: "wrong_group" }
end.to raise_error ActiveRecord::RecordNotFound
end
it "raises an error if group id is not found" do
expect do
get :edit, params: { budget_id: 0, id: "wrong_group" }
end.to raise_error ActiveRecord::RecordNotFound
end
end
end