The interface was a bit confusing, since after clicking on "See unfeasible investments" (or similar), we were on a page where no investments were shown. Besides, since commit7e3dd47d5, the group page is only linked from the "my ballot" page, through a link inviting the user to vote in that group, and it's only possible to vote selected investments (which is the default filter during the final voting phase). The only reason we had these links here was these links weren't present in the investments page. But they're present there since commit04605d5d5, so we don't need them in the group page anymore.
50 lines
1.4 KiB
Ruby
50 lines
1.4 KiB
Ruby
require "rails_helper"
|
|
|
|
describe "Budget Groups" do
|
|
let(:budget) { create(:budget, slug: "budget_slug") }
|
|
let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) }
|
|
|
|
context "Load" do
|
|
scenario "finds group using budget slug and group slug" do
|
|
visit budget_group_path("budget_slug", "group_slug")
|
|
expect(page).to have_content "Select a heading"
|
|
end
|
|
|
|
scenario "finds group using budget id and group id" do
|
|
visit budget_group_path(budget, group)
|
|
expect(page).to have_content "Select a heading"
|
|
end
|
|
end
|
|
|
|
context "Show" do
|
|
scenario "Headings are sorted by name" do
|
|
last_heading = create(:budget_heading, group: group, name: "BBB")
|
|
first_heading = create(:budget_heading, group: group, name: "AAA")
|
|
|
|
visit budget_group_path(budget, group)
|
|
|
|
expect(first_heading.name).to appear_before(last_heading.name)
|
|
end
|
|
|
|
scenario "Back link" do
|
|
visit budget_group_path(budget, group)
|
|
|
|
click_link "Go back"
|
|
|
|
expect(page).to have_current_path budget_path(budget)
|
|
end
|
|
end
|
|
|
|
context "Index" do
|
|
scenario "Render headings" do
|
|
create(:budget_heading, group: group, name: "New heading name")
|
|
|
|
visit budget_groups_path(budget)
|
|
|
|
expect(page).to have_content "Select a heading"
|
|
expect(page).to have_link "New heading name"
|
|
expect(page).to have_link "Go back", href: budget_path(budget)
|
|
end
|
|
end
|
|
end
|