Skip to content

Preserve field value when transition validation fails#81

Open
regiscamimura wants to merge 1 commit into5monkeys:masterfrom
regiscamimura:fix/transition-validation-preserves-state
Open

Preserve field value when transition validation fails#81
regiscamimura wants to merge 1 commit into5monkeys:masterfrom
regiscamimura:fix/transition-validation-preserves-state

Conversation

@regiscamimura
Copy link
Copy Markdown

Fixes #80

When an invalid transition is attempted, the field setter was updating the stored value before running validation. This meant that even though InvalidStatusOperationError was raised, the field already held the invalid value.

Moved validate_valid_transition() to run before the assignment so the field retains its previous value on failure.

Added a test that confirms the field value is preserved after a rejected transition.

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.

Transition validation failure leaves field in unvalidated state

1 participant