aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb
blob: 8c62690866858e9840599d3b07a39cad1a6b928a (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
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