Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Change spec helpers to skip over incomplete models

* If a model was created for some other purpose, besides testing its
  persistence logic, it's likely it was an anonymous class and may be considered
  incomplete and impossible to auto-migrate.
  • Loading branch information...
commit 1cda2bec4eded8cbd16b7f81628aa9d4e937918b 1 parent e7d51df
@dkubb dkubb authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/dm-core/spec/lib/adapter_helpers.rb
View
12 lib/dm-core/spec/lib/adapter_helpers.rb
@@ -29,7 +29,11 @@ def describe_adapter(kind, &block)
# create all tables and constraints before each spec
DataMapper::Model.descendants.each do |model|
next unless model.respond_to?(:auto_migrate!)
- model.auto_migrate!(@repository.name)
+ begin
+ model.auto_migrate!(@repository.name)
+ rescue IncompleteModelError
+ # skip incomplete models
+ end
end
end
@@ -37,7 +41,11 @@ def describe_adapter(kind, &block)
# remove all tables and constraints after each spec
DataMapper::Model.descendants.each do |model|
next unless model.respond_to?(:auto_migrate_down!)
- model.auto_migrate_down!(@repository.name)
+ begin
+ model.auto_migrate_down!(@repository.name)
+ rescue IncompleteModelError
+ # skip incomplete models
+ end
end
# TODO consider proper automigrate functionality
if @adapter.respond_to?(:reset)

0 comments on commit 1cda2be

Please sign in to comment.
Something went wrong with that request. Please try again.