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

Adds test for double coercion bug on subclasses #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arfl
Copy link

@arfl arfl commented Jul 1, 2016

Hi,
After the switch from Virtus to DryTypes we get coercion errors on subclasses. The setter here gets called twice then, the first time with the string, the second time with an already coerced value and results in a TypeError.
In this pull request I added a test simulating this behaviour.

Thank you

Andreas

subclassed = Class.new(TwinWithSkipSetter).new(album)
subclassed.released_at.must_equal "31/03/1981"

subclassed.released_at = "12/12/1980"
Copy link
Author

Choose a reason for hiding this comment

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

He, you get a TypeError because the value "31/03/1981" gets coerced twice, the first time with the string, the second time with a DateTime.

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