class Cucumber::Rails::Database::SharedConnectionStrategy
Public Instance Methods
before_js()
click to toggle source
# File lib/cucumber/rails/database.rb, line 90 def before_js # Forces all threads to share a connection on a per-model basis, # as connections may vary per model as per establish_connection. This works # on Capybara because it starts the web server in a thread. ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection ActiveRecord::Base.descendants.each do |model| model.shared_connection = model.connection end end
before_non_js()
click to toggle source
# File lib/cucumber/rails/database.rb, line 100 def before_non_js # Do not use a shared connection unless we're in a @javascript scenario ActiveRecord::Base.shared_connection = nil ActiveRecord::Base.descendants.each do |model| model.shared_connection = nil end end