aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/subscription_adapter/postgresql_test.rb
blob: 64c632b0cda4b52210f8411ab75f74ae585d6d56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'test_helper'
require_relative './common'

require 'active_record'

class PostgresqlAdapterTest < ActionCable::TestCase
  include CommonSubscriptionAdapterTest

  def setup
    database_config = { 'adapter' => 'postgresql', 'database' => 'activerecord_unittest' }
    ar_tests = File.expand_path('../../../activerecord/test', __dir__)
    if Dir.exist?(ar_tests)
      require File.join(ar_tests, 'config')
      require File.join(ar_tests, 'support/config')
      local_config = ARTest.config['arunit']
      database_config.update local_config if local_config
    end
    ActiveRecord::Base.establish_connection database_config

    super
  end

  def teardown
    super

    ActiveRecord::Base.clear_all_connections!
  end

  def cable_config
    { adapter: 'postgresql' }
  end
end