Skip to content

Adds test for double coercion bug on subclasses#43

Open
arfl wants to merge 1 commit intoapotonick:masterfrom
arfl:master
Open

Adds test for double coercion bug on subclasses#43
arfl wants to merge 1 commit intoapotonick:masterfrom
arfl:master

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