Skip to content

ldeb step next step slug after routing multiple conditions#2068

Closed
lfdebrux wants to merge 2 commits into
mainfrom
ldeb-step-next-step-slug-after-routing-multiple-conditions
Closed

ldeb step next step slug after routing multiple conditions#2068
lfdebrux wants to merge 2 commits into
mainfrom
ldeb-step-next-step-slug-after-routing-multiple-conditions

Conversation

@lfdebrux
Copy link
Copy Markdown
Contributor

  • Refactor specs for Step#next_step_slug_after_routing
    Change id and the next_step_id for the step being tested so that
    they're different from the step IDs for steps we're routing to; this
    makes it harder to write tests that pass with a false positive (for
    instance, if you expect second_step_id, before that could have been
    because the routing was returning the default route, instead of routing
    to the second step).

  • Allow routing to work with multiple conditions
    Update the logic in Step#next_step_slug_after_routing so that it will
    match a routing condition even if it isn't the first condition. This
    should allow forms-runner to support forms with multiple branches.

    Note that this still won't match a "default" condition (answer_value of
    nil) that isn't the first in the list of routing conditions; our plans
    for routing don't currently have a use case for a default condition on a
    selection question, so there shouldn't be a situation where there are
    multiple conditions and one of them is a default condition.

Change `id` and the `next_step_id` for the step being tested so that
they're different from the step IDs for steps we're routing to; this
makes it harder to write tests that pass with a false positive (for
instance, if you expect `second_step_id`, before that could have been
because the routing was returning the default route, instead of routing
to the second step).
Update the logic in Step#next_step_slug_after_routing so that it will
match a routing condition even if it isn't the first condition. This
should allow forms-runner to support forms with multiple branches.

Note that this still won't match a "default" condition (answer_value of
`nil`) that isn't the first in the list of routing conditions; our plans
for routing don't currently have a use case for a default condition on a
selection question, so there shouldn't be a situation where there are
multiple conditions and one of them is a default condition.
@lfdebrux lfdebrux closed this Apr 28, 2026
@lfdebrux lfdebrux deleted the ldeb-step-next-step-slug-after-routing-multiple-conditions branch April 28, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant