This project is archived and is in readonly mode.
[PATCH] ActionDispatch::TestProcess::assigns breaks array tests due to HashWithIndifferentAccess
Reported by Larry Sprock | November 12th, 2010 @ 12:53 AM
I ran across this issue while upgrading a large, well tested app to rails3. Basically, anywhere in the specs where we where testing for a WillPaginate::Collection or methods on a WillPaginate::Collection would fail. I narrowed it down to HashWithIndifferentAccess replacing arrays or anything subclassing arrays with a new array via collect (#convert_value hash_with_indifferent_access.rb:143).
I would like some help resolving this issue. The attached patch is a first pass at fixing it and it works for the general use case, however, problems arise if you use caching which basically creates a frozen object. Any array that is frozen throws an exception because replace is trying to modify the array...
Example of failing test: https://gist.github.com/667961
Comments and changes to this ticket
-
Larry Sprock November 14th, 2010 @ 01:01 AM
- Title changed from HashWithIndifferentAccess should not change the class of an array to ActionDispatch::TestProcess::assigns breaks array tests do to HashWithIndifferentAccess
- Tag set to activesupport, assigns, testing
-
Larry Sprock November 14th, 2010 @ 01:08 AM
- Assigned user set to Michael Koziarski
-
Larry Sprock November 14th, 2010 @ 05:41 AM
- Title changed from ActionDispatch::TestProcess::assigns breaks array tests do to HashWithIndifferentAccess to ActionDispatch::TestProcess::assigns breaks array tests due to HashWithIndifferentAccess
-
Larry Sprock November 14th, 2010 @ 07:04 AM
- Title changed from ActionDispatch::TestProcess::assigns breaks array tests due to HashWithIndifferentAccess to [PATCH] ActionDispatch::TestProcess::assigns breaks array tests due to HashWithIndifferentAccess
Ok, Sorted and tests passing... Can someone have a look?
Thanks
-
José Valim November 14th, 2010 @ 09:15 AM
- State changed from new to resolved
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>