aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/uuid_test.rb
diff options
context:
space:
mode:
authorEugene Kenny <elkenny@gmail.com>2017-06-10 23:21:12 +0100
committerEugene Kenny <elkenny@gmail.com>2017-06-14 20:24:58 +0100
commitb0180c910ee28efa8dd972401156062c8800707d (patch)
tree32aabfacf50c581bd8b17e4e7c2ac3e308dcb423 /activerecord/test/cases/adapters/postgresql/uuid_test.rb
parent816a3763d9bb070bf339de32c6a3ce31a45369f8 (diff)
downloadrails-b0180c910ee28efa8dd972401156062c8800707d.tar.gz
rails-b0180c910ee28efa8dd972401156062c8800707d.tar.bz2
rails-b0180c910ee28efa8dd972401156062c8800707d.zip
Allow `uuid_test.rb` to be loaded on all adapters
Running `bin/test` from the activerecord directory produces this error: test/cases/adapters/postgresql/uuid_test.rb:43:in `<class:PostgresqlUUIDTest>': undefined method `supports_pgcrypto_uuid?' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x007fc405e72a68> (NoMethodError) The test only actually runs on the PostgreSQL adapter; we can avoid triggering the error on other adapters with this `respond_to?` guard.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/uuid_test.rb')
-rw-r--r--activerecord/test/cases/adapters/postgresql/uuid_test.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb
index d124b64861..8eddd81c38 100644
--- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb
@@ -40,7 +40,8 @@ class PostgresqlUUIDTest < ActiveRecord::PostgreSQLTestCase
drop_table "uuid_data_type"
end
- if ActiveRecord::Base.connection.supports_pgcrypto_uuid?
+ if ActiveRecord::Base.connection.respond_to?(:supports_pgcrypto_uuid?) &&
+ ActiveRecord::Base.connection.supports_pgcrypto_uuid?
def test_uuid_column_default
connection.add_column :uuid_data_type, :thingy, :uuid, null: false, default: "gen_random_uuid()"
UUIDType.reset_column_information