Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback value for unsigned hashids #46

Merged
merged 4 commits into from
Jan 13, 2018
Merged

Conversation

jcypret
Copy link
Owner

@jcypret jcypret commented Jan 13, 2018

This PR fixes an issue identified here: #45.

The .find for unsigned hashids is not currently falling back to the default value. This PR fixes that by extended the test suite to exercise the same find and find_by_hashid tests across both the signed and unsigned models. This shows the test failure which is then fixed by adding a fallback.

When sigining hashids is disabled, the find method should fall back to
using the passed in ID when unable to decode.
Instead of repeating the find specs, the find methods are now a shared example run in both contexts.
@jcypret jcypret merged commit c45cc8a into master Jan 13, 2018
@jcypret jcypret deleted the unsigned-rails-fixtures branch January 13, 2018 19:32
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