Add non-prefixed polymorphic admin routes
These routes are solved in a different way because of an inconsistency: we define `groups` and `budget_investments`; we should either use the `budget_` prefix in all places or remove it everywhere. We can now share code using `polymorphic_path` even with these models.
This commit is contained in:
@@ -50,6 +50,56 @@ describe "Polymorphic routes" do
|
||||
describe "admin_polymorphic_path" do
|
||||
include ActionDispatch::Routing::UrlFor
|
||||
|
||||
it "routes budget investments" do
|
||||
budget = create(:budget)
|
||||
investment = create(:budget_investment, budget: budget)
|
||||
|
||||
expect(admin_polymorphic_path(investment)).to eq(
|
||||
admin_budget_budget_investment_path(budget, investment)
|
||||
)
|
||||
end
|
||||
|
||||
it "routes budget groups" do
|
||||
budget = create(:budget)
|
||||
group = create(:budget_group, budget: budget)
|
||||
|
||||
expect(admin_polymorphic_path(group)).to eq(admin_budget_group_path(budget, group))
|
||||
end
|
||||
|
||||
it "routes budget headings" do
|
||||
budget = create(:budget)
|
||||
group = create(:budget_group, budget: budget)
|
||||
heading = create(:budget_heading, group: group)
|
||||
|
||||
expect(admin_polymorphic_path(heading)).to eq(
|
||||
admin_budget_group_heading_path(budget, group, heading)
|
||||
)
|
||||
end
|
||||
|
||||
it "routes poll booths" do
|
||||
booth = create(:poll_booth)
|
||||
|
||||
expect(admin_polymorphic_path(booth)).to eq(admin_booth_path(booth))
|
||||
end
|
||||
|
||||
it "routes poll officers" do
|
||||
officer = create(:poll_officer)
|
||||
|
||||
expect(admin_polymorphic_path(officer)).to eq admin_officer_path(officer)
|
||||
end
|
||||
|
||||
it "routes poll questions" do
|
||||
question = create(:poll_question)
|
||||
|
||||
expect(admin_polymorphic_path(question)).to eq(admin_question_path(question))
|
||||
end
|
||||
|
||||
it "routes poll answer videos" do
|
||||
video = create(:poll_answer_video)
|
||||
|
||||
expect(admin_polymorphic_path(video)).to eq admin_video_path(video)
|
||||
end
|
||||
|
||||
it "routes milestones for resources with no hierarchy" do
|
||||
proposal = create(:proposal)
|
||||
milestone = create(:milestone, milestoneable: proposal)
|
||||
|
||||
Reference in New Issue
Block a user