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

validate_presence_of(:active_storage_field) throws exception #1224

Conversation

gmmcal
Copy link
Contributor

@gmmcal gmmcal commented Jun 18, 2019

When trying to test validation of presence against a active storage relation, shoulda tries to set the attribute as empty string. This makes the association fail to be set and breaks the test.

I've introduced a block that checks if the field is an active storage relation and only allows nil to be set to the object.

Fixes #1223

When trying to test validation of presence against a active storage relation, shoulda tries to set the attribute as empty string. This makes the association fail to be set and breaks the test.

I've introduced a block that checks if the field is an active storage relation and only allows `nil` to be set to the object.

Fixes thoughtbot#1223
Copy link
Collaborator

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks for this PR. Just had a few suggestions.

@mcmire mcmire added this to the v4.1.1 milestone Jul 6, 2019
@gmmcal
Copy link
Contributor Author

gmmcal commented Jul 6, 2019

@mcmire I'll wait on your reply to item 1 and push the fixes :)

Copy link
Contributor Author

@gmmcal gmmcal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changed

Copy link
Collaborator

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good 👍

@mcmire mcmire merged commit a2231f8 into thoughtbot:master Jul 9, 2019
@gmmcal gmmcal deleted the issue-1223-validate_presence_of-active_storage-field-throws-exception branch July 12, 2019 19:09
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.

validate_presence_of(:active_storage_field) throws exception
2 participants