ldeb step next step slug after routing multiple conditions#2068
Closed
lfdebrux wants to merge 2 commits into
Closed
ldeb step next step slug after routing multiple conditions#2068lfdebrux wants to merge 2 commits into
lfdebrux wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor specs for Step#next_step_slug_after_routing
Change
idand thenext_step_idfor the step being tested so thatthey'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 beenbecause 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 plansfor 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.