Skip to content

Commit

Permalink
Run schema dumper extensions without creating real extensions
Browse files Browse the repository at this point in the history
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
carlosantoniodasilva committed Feb 7, 2013
1 parent 86f4db9 commit 1b75666
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions activerecord/test/cases/schema_dumper_test.rb
@@ -1,6 +1,5 @@
require "cases/helper"


class SchemaDumperTest < ActiveRecord::TestCase
def setup
super
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1b75666

Please sign in to comment.