Use polymorphic routes to manage cards
We use a different logic to load the card depending on the controller we're using, and then share the rest of the code. This way we simplify the code a bit, since we don't have to check for the page_id parameter.
This commit is contained in:
@@ -164,6 +164,19 @@ describe "Polymorphic routes" do
|
||||
expect(admin_polymorphic_path(shift)).to eq(admin_booth_shift_path(booth, shift))
|
||||
end
|
||||
|
||||
it "routes widget cards" do
|
||||
card = create(:widget_card)
|
||||
|
||||
expect(admin_polymorphic_path(card)).to eq(admin_widget_card_path(card))
|
||||
end
|
||||
|
||||
it "routes site customization page widget cards" do
|
||||
page = create(:site_customization_page)
|
||||
card = create(:widget_card, page: page)
|
||||
|
||||
expect(admin_polymorphic_path(card)).to eq admin_site_customization_page_widget_card_path(page, card)
|
||||
end
|
||||
|
||||
it "supports routes for actions like edit" do
|
||||
proposal = create(:proposal)
|
||||
milestone = create(:milestone, milestoneable: proposal)
|
||||
|
||||
Reference in New Issue
Block a user