Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Setup test database using migration instead of auto_migrate

  • Loading branch information...
commit 9aba760cad0bf65854ea2c973970913fc83e60fc 1 parent 2292554
@sr sr authored
View
3  lib/integrity/migrations.rb
@@ -143,7 +143,8 @@ class ::Integrity::Build
end
down do
- modify_table(:integrity_notifiers) { remove_column :enabled }
+ # TODO: sqlite doesn't support DROP COLUMN ...
+ # modify_table(:integrity_notifiers) { drop_column :enabled }
end
end
end
View
19 test/helpers.rb
@@ -68,27 +68,20 @@ class << self
end
before(:each) do
+ require "integrity/migrations"
+ [Project, Build, Commit, Notifier].each(&:auto_migrate_down!)
+ capture_stdout { Integrity.migrate_db }
+
RR.reset
- DataMapper.auto_migrate!
+
Notifier.available.each { |n|
Notifier.send(:remove_const, n.to_s.split(":").last.to_sym)
}
Integrity.instance_variable_set(:@config, nil)
Integrity.instance_variable_set(:@notifiers, nil)
-
- repository(:default) do
- transaction = DataMapper::Transaction.new(repository)
- transaction.begin
- repository.adapter.push_transaction(transaction)
- end
end
after(:each) do
- repository(:default) do
- while repository.adapter.current_transaction
- repository.adapter.current_transaction.rollback
- repository.adapter.pop_transaction
- end
- end
+ capture_stdout { Integrity::Migrations.migrate_down! }
end
end
View
1  test/unit/migrations_test.rb
@@ -24,6 +24,7 @@ def load_initial_migration_fixture
before(:each) do
[Project, Build, Commit, Notifier].each(&:auto_migrate_down!)
+ database_adapter.execute("DROP TABLE migration_info")
assert !table_exists?("migration_info") # just to be sure
end
Please sign in to comment.
Something went wrong with that request. Please try again.