Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More robust checks before checking module inclusion

Specs for in_memory and yaml still fail, but at
least they're running now. Previously they bailed
out immediately because of calling [] (lambda.call)
on nil.

This (like many other dm-migrations specs) looks
kinda weird and will probably be refactored soonish
  • Loading branch information...
commit fcbc2e4452aee2804bff8fd81af533293678c278 1 parent 3abbc5e
@snusnu snusnu authored
Showing with 12 additions and 7 deletions.
  1. +12 −7 spec/integration/migration_spec.rb
View
19 spec/integration/migration_spec.rb
@@ -54,15 +54,20 @@
end
adapter = DataMapper::Spec.adapter_name
- expected_module = {
- :sqlite => lambda { SQL::Sqlite },
- :mysql => lambda { SQL::Mysql },
+
+ expected_module_lambda = {
+ :sqlite => lambda { SQL::Sqlite },
+ :mysql => lambda { SQL::Mysql },
:postgres => lambda { SQL::Postgres }
- }[adapter.to_sym][]
+ }[adapter.to_sym]
+
+ expected_module = expected_module_lambda ? expected_module_lambda.call : nil
- it "should extend with #{expected_module} when adapter is #{adapter}" do
- migration = DataMapper::Migration.new(1, :"#{adapter}_adapter_test") { }
- (class << migration.adapter; self; end).included_modules.should include(expected_module)
+ if expected_module
+ it "should extend with #{expected_module} when adapter is #{adapter}" do
+ migration = DataMapper::Migration.new(1, :"#{adapter}_adapter_test") { }
+ (class << migration.adapter; self; end).included_modules.should include(expected_module)
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.