aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJustin George <justin.george@gmail.com>2013-02-06 15:55:58 -0800
committerJustin George <justin.george@gmail.com>2013-02-06 16:01:25 -0800
commite2fdfa9c07e1ec643dc4658a1a12075d9cc26c79 (patch)
tree7168784b52e27c46680e137516ebc790c564b868 /activerecord/test
parentc0990f040f13d408786abf4a2d4ce97e7917f86c (diff)
downloadrails-e2fdfa9c07e1ec643dc4658a1a12075d9cc26c79.tar.gz
rails-e2fdfa9c07e1ec643dc4658a1a12075d9cc26c79.tar.bz2
rails-e2fdfa9c07e1ec643dc4658a1a12075d9cc26c79.zip
improve tests to check for existence of extensions method, and skip testing dumped extensions if they are unsupported by the database
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/hstore_test.rb1
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb15
2 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
index 2b660457c4..6640f9b497 100644
--- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
@@ -36,6 +36,7 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase
end
def test_hstore_included_in_extensions
+ assert @connection.respond_to?(:extensions), "connection should have a list of extensions"
assert @connection.extensions.include?('hstore'), "extension list should include hstore"
end
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index d702c0f8d1..c5092e15ea 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -231,15 +231,14 @@ class SchemaDumperTest < ActiveRecord::TestCase
end
if current_adapter?(:PostgreSQLAdapter)
- if ActiveRecord::Base.connection.supports_extensions?
- def test_schema_dump_includes_extensions
- connection = ActiveRecord::Base.connection
- unless connection.extension_enabled?('hstore')
- connection.enable_extension 'hstore'
- end
- output = standard_dump
- assert_match %r{enable_extension "hstore"}, output
+ def test_schema_dump_includes_extensions
+ connection = ActiveRecord::Base.connection
+ return skip unless connection.supports_extensions?
+ unless connection.extension_enabled?('hstore')
+ connection.enable_extension 'hstore'
end
+ output = standard_dump
+ assert_match %r{enable_extension "hstore"}, output
end
def test_schema_dump_includes_xml_shorthand_definition