Files
nairobi/spec/components/admin/budgets/table_actions_component_spec.rb
Javi Martín 5531a0b2bc Simplify action links in budgets table
The word "budget" in the "Preview budget" link is redundant.

On the other hand, the words "Manage", Edit" and "Admin" are not
really necessary in my humble opinion. Just like in the admin
navigation menu we use "Participatory budgets" instead of "Manage
Participatory budgets", the fact that we're going to manage or
admin or edit something can be deduced from the fact that we're in
the admin section.

Besides, it isn't clear to me why we use "Manage" for projects,
"Edit" for heading groups and "Admin" for ballots. The differences
between these three concepts might be too subtle for me.

The previous paragraphs haven't been corroborated with real users,
though, so I might be mistaken and we might need to revisit these
links in the future.

These actions still take quite a lot of space. Maybe in the future we
could remove the "delete" icon, at least on budgets which cannot be
deleted.
2021-06-30 14:33:37 +02:00

37 lines
1.2 KiB
Ruby

require "rails_helper"
describe Admin::Budgets::TableActionsComponent, type: :component do
let(:budget) { create(:budget) }
let(:component) { Admin::Budgets::TableActionsComponent.new(budget) }
before do
allow(ViewComponent::Base).to receive(:test_controller).and_return("Admin::BaseController")
end
it "renders links to edit and delete budget, manage investments and edit groups and manage ballots" do
render_inline component
expect(page).to have_css "a", count: 6
expect(page).to have_link "Investment projects", href: /investments/
expect(page).to have_link "Heading groups", href: /groups/
expect(page).to have_link "Edit", href: /edit/
expect(page).to have_link "Ballots"
expect(page).to have_link "Preview", href: /budgets/
expect(page).to have_link "Delete", href: /budgets/
end
it "renders link to create new poll for budgets without polls" do
render_inline component
expect(page).to have_css "a[href*='polls'][data-method='post']", 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