Files
grecia/spec/components/admin/budgets/table_actions_component_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

34 lines
1.1 KiB
Ruby

require "rails_helper"
describe Admin::Budgets::TableActionsComponent, controller: Admin::BaseController do
let(:budget) { create(:budget) }
let(:component) { Admin::Budgets::TableActionsComponent.new(budget) }
it "renders actions to edit and delete budget, manage investments and manage ballots" do
render_inline component
expect(page).to have_link count: 3
expect(page).to have_link "Investment projects", href: /investments/
expect(page).to have_link "Edit", href: /#{budget.id}\Z/
expect(page).to have_link "Preview", href: /budgets/
expect(page).to have_button count: 2
expect(page).to have_css "form[action*='budgets']", exact_text: "Delete"
expect(page).to have_button "Ballots"
end
it "renders button to create new poll for budgets without polls" do
render_inline component
expect(page).to have_css "form[action*='polls'][method='post']", exact_text: "Ballots"
end
it "renders link to manage ballots for budgets with polls" do
budget.poll = create(:poll, budget: budget)
render_inline component
expect(page).to have_link "Ballots", href: /booth_assignments/
end
end