Rails 6.1 Compatibility
fdietz opened this issue · 5 comments
Hi everone and thank you so much for cypress-rails. I've been really enjoying writing e2e tests!
Has anone tested this gem with rails 6.1? I cannot seem to get rake cypress:run
oder rake cypress:open
to work.
It seems to be related to the recent changes in ActiveRecord with connection handling, unfortunately not my area of expertise.
I'm running in the following Problem on startup:
raceback (most recent call last):
6: from /home/fdietz/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/cypress-rails-0.4.1/exe/cypress-rails:15:in `<main>'
5: from /home/fdietz/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/cypress-rails-0.4.1/lib/cypress-rails/run.rb:11:in `call'
4: from /home/fdietz/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/cypress-rails-0.4.1/lib/cypress-rails/launches_cypress.rb:20:in `call'
3: from /home/fdietz/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/cypress-rails-0.4.1/lib/cypress-rails/manages_transactions.rb:10:in `begin_transaction'
2: from /home/fdietz/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/cypress-rails-0.4.1/lib/cypress-rails/manages_transactions.rb:59:in `gather_connections'
1: from /home/fdietz/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/cypress-rails-0.4.1/lib/cypress-rails/manages_transactions.rb:74:in `setup_shared_connection_pool'
/home/fdietz/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.1.0/lib/active_record/core.rb:170:in `connection_handlers': The new connection handling does not support accessing multiple connection handlers. (NotImplementedError)
I've tried to make it work with the config.active_record.legacy_connection_handling = true
flag. This way I can at least start the tests. But now the after_transaction_start
hook which inserts some ActiveRecord in the db doesn't work. In this hook the objects are correctly inserted, but there are not visible during the test run itself.
Any ideas? Thanks in advance!
Hey @fdietz thanks for reporting this. Unfortunately I haven't run cypress-rails on Rails 6.1 in any of my apps yet. If you have a chance to run the gem from source and try to debug this one, I'd appreciate it
Hi @searls! I've got it working by skipping setup_shared_connection_pool
completely. Unfortunately, I don't know if this is the right way to go in more complex database settings. Quite a few changes in Rails 6.1. for handling more complex database scenarios.
ActiveRecord::Base.connection_handler
is implemented in Rails 6.1. and raises this message: The new connection handling does not support accessing multiple connection handlers. (NotImplementedError)
Skipping it will make it work for a simple setups, like mine. Legacy mode doesn't work due to the error raised above.
Should be fixed (working for me at least) in 0.4.2
Thank you so much for looking into this 🎉 Works perfectly for me, too 👍
I am running Rails 5.2.4.4
and Cypress wouldn't start after upgrading to 0.4.2
complaining about the setup_shared_connection_pool
method. I downgraded to "0.4.1" and got it working again.