Google Groups

quick hack to enable transactional fixtures with akephalos driver


hiroshi3110 Mar 14, 2011 4:05 AM
Posted in group: Capybara
To turn on transactional fixtures with akephalos driver, I wrote a
monkey patch.

ActiveRecord::ConnectionAdapters::ConnectionPool.class_eval do
  def current_connection_id
    # Thread.current.object_id
    Thread.main.object_id
  end
end

This could be placed in spec_helper.rb.

I don't think it is a safe and correct way, but someone may be
interested in the idea.
To get right, it will be needed a synchronous version of server,
handling http requests like handling user inputs with gets(3).

I also wrote a blog post about this:
http://blog.yakitara.com/2011/03/use-transactionalfixtures-with-capybara.html
Sorry for that most part of the article are written in Japanese,
describing some background behind the idea.