diff options
author | Prathamesh Sonpatki <csonpatki@gmail.com> | 2016-11-19 21:52:52 +0530 |
---|---|---|
committer | Prathamesh Sonpatki <csonpatki@gmail.com> | 2016-11-19 21:52:52 +0530 |
commit | 7b6b52d6bcd204aaddcdc36481956d73a54ea7bb (patch) | |
tree | b67e9cd63fdc07f6a9d841b417be35fe2f108262 /activerecord/test/cases/adapters/postgresql | |
parent | ff2fe014d916a2f7c4330ca7208a857bd0ef8992 (diff) | |
download | rails-7b6b52d6bcd204aaddcdc36481956d73a54ea7bb.tar.gz rails-7b6b52d6bcd204aaddcdc36481956d73a54ea7bb.tar.bz2 rails-7b6b52d6bcd204aaddcdc36481956d73a54ea7bb.zip |
Fix tests for prepared_statements: false and queries hitting `#select_all`
- The query needs to be executed for hitting `select_all` so made sure
that query gets executed.
- Also instead of changing instance variable, just add new
configuration for prepared_statements: false and use it for this
test.
- This way we don't have to touch the internals of AR code and still
disable prepared statements config for this test.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb b/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb index 181c1a097c..1214b28366 100644 --- a/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb +++ b/activerecord/test/cases/adapters/postgresql/prepared_statements_test.rb @@ -6,17 +6,17 @@ class PreparedStatementsTest < ActiveRecord::PostgreSQLTestCase fixtures :developers def setup - @default_prepared_statements = ActiveRecord::Base.connection.instance_variable_get("@prepared_statements") - ActiveRecord::Base.connection.instance_variable_set("@prepared_statements", false) + @conn = ActiveRecord::Base.establish_connection :arunit_with_prepared_statements end def teardown - ActiveRecord::Base.connection.instance_variable_set("@prepared_statements", @default_prepared_statements) + @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) + Developer.where(id: 1).to_a end end end |