Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Run schema dumper extensions without creating real extensions

There is no need to create the extension in the database just to test if
it's dumped, we can stub that instead.
  • Loading branch information...
commit 1b75666f7f4ec7f013182d24b919ca27b0ca0068 1 parent 86f4db9
@carlosantoniodasilva carlosantoniodasilva authored
Showing with 2 additions and 9 deletions.
  1. +2 −9 activerecord/test/cases/schema_dumper_test.rb
11 activerecord/test/cases/schema_dumper_test.rb
@@ -1,6 +1,5 @@
require "cases/helper"
class SchemaDumperTest < ActiveRecord::TestCase
def setup
@@ -233,19 +232,13 @@ def test_schema_dump_includes_decimal_options
if current_adapter?(:PostgreSQLAdapter)
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
+ connection.stubs(:extensions).returns(['hstore'])
output = standard_dump
assert_match "# These are extensions that must be enabled", output
assert_match %r{enable_extension "hstore"}, output
- connection.extensions.each do |ext|
- connection.disable_extension ext
- end
+ connection.stubs(:extensions).returns([])
output = standard_dump
assert_no_match "# These are extensions that must be enabled", output
assert_no_match %r{enable_extension}, output
Please sign in to comment.
Something went wrong with that request. Please try again.