Permalink
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...
1 parent 86f4db9 commit 1b75666f7f4ec7f013182d24b919ca27b0ca0068 @carlosantoniodasilva carlosantoniodasilva committed Feb 7, 2013
Showing with 2 additions and 9 deletions.
  1. +2 −9 activerecord/test/cases/schema_dumper_test.rb
View
11 activerecord/test/cases/schema_dumper_test.rb
@@ -1,6 +1,5 @@
require "cases/helper"
-
class SchemaDumperTest < ActiveRecord::TestCase
def setup
super
@@ -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

0 comments on commit 1b75666

Please sign in to comment.