diff options
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb | 25 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb | 22 |
2 files changed, 25 insertions, 22 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb b/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb new file mode 100644 index 0000000000..8c62690866 --- /dev/null +++ b/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb @@ -0,0 +1,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 diff --git a/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb b/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb deleted file mode 100644 index b469e66507..0000000000 --- a/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb +++ /dev/null @@ -1,22 +0,0 @@ -require "cases/helper" -require "models/computer" -require "models/developer" - -class PreparedStatementsTest < 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_nothing_raised_with_falsy_prepared_statements - assert_nothing_raised do - Developer.where(id: 1).to_a - end - end -end |