This project is archived and is in readonly mode.
[PATCH] integration test sessions fixture fix
Reported by Andrew Kaspick | August 4th, 2010 @ 08:49 PM
In integration tests when creating a new session with open_session, fixtures would no longer be accessible in the new session.
# works
companies(:test)
open_session do |sess|
# fixtures not accessible on sess... error
#sess.companies(:test)
end
The code was broken because the existing session instance adds the fixture methods by checking if the current session responds to the fixture method name with respond_to?, but the fixture methods are private and would return false which would prevent the fixture methods in the new session from being created. Passing true to respond_to? checks private methods as well, which would then return true and then create the fixture access methods in the new session.
The patch should explain the issue more clearly.
Comments and changes to this ticket
-
Andrew Kaspick August 4th, 2010 @ 08:55 PM
The issue becomes more apparent when extending the session with a module that makes use of fixtures. In this example, if a method in HelperMethods tries to access a fixture, it wouldn't work. This patch fixes that issue.
open_session do |sess| sess.extend HelperMethods end
-
Andrew Kaspick August 4th, 2010 @ 08:57 PM
- Tag set to patch, rails_2_3_stable
-
Andrew Kaspick August 4th, 2010 @ 08:58 PM
- Tag changed from patch, rails_2_3_stable to integration_test, patch, rails_2_3_stable
-
Andrew Kaspick August 6th, 2010 @ 05:30 AM
- Tag changed from integration_test, patch, rails_2_3_stable to integration_test, open_session, patch, rails_2_3_stable, tests
-
Robert Pankowecki August 7th, 2010 @ 10:41 AM
The patch looks fine for me. Test is also included so I think we should take it.
-
Michael Koziarski September 9th, 2010 @ 11:47 PM
- State changed from new to committed
- Importance changed from to Low
Applied in a159fd0
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>