diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-11-20 14:32:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-20 14:32:28 +0100 |
commit | e6c808e354cdc2a8d9274caa6668fdfc145a255d (patch) | |
tree | b6a44f43c03216802039e0b2250b4fa3372f6f8f | |
parent | 9008a60dc5c24b0fe884087095900797ace6263a (diff) | |
parent | 8b77d8e387079da2d5d4cf2f6fcc4864195852bc (diff) | |
download | rails-e6c808e354cdc2a8d9274caa6668fdfc145a255d.tar.gz rails-e6c808e354cdc2a8d9274caa6668fdfc145a255d.tar.bz2 rails-e6c808e354cdc2a8d9274caa6668fdfc145a255d.zip |
Merge pull request #27118 from prathamesh-sonpatki/correct-prepared-statements-test
Fix prepared statements disabled test again
-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 |