aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb
blob: 0120e33f70af8befd2a0a4aef4eeec83c30beb96 (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
# frozen_string_literal: true
require "cases/helper"
require "models/computer"
require "models/developer"

class PreparedStatementsDisabledTest < ActiveRecord::PostgreSQLTestCase
  fixtures :developers

  def setup
    @conn = ActiveRecord::Base.establish_connection :arunit_without_prepared_statements
  end

  def teardown
    @conn.release_connection
    ActiveRecord::Base.establish_connection :arunit
  end

  def test_select_query_works_even_when_prepared_statements_are_disabled
    assert_not Developer.connection.prepared_statements

    david = developers(:david)

    assert_equal david, Developer.where(name: "David").last # With Binds
    assert_operator Developer.count, :>, 0 # Without Binds
  end
end