lib/switchman/test_helper.rb in switchman-1.4.4 vs lib/switchman/test_helper.rb in switchman-1.5.0

- old
+ new

@@ -33,11 +33,16 @@ shard1.save! if shard1.changed? shard2 ||= server2.shards.build shard2.name = server1.config[:shard2] shard2.save! if shard2.changed? - recreate_shards = shard1.activate { ::ActiveRecord::Base.connection.tables == [] } + recreate_shards = begin + shard1.activate { ::ActiveRecord::Base.connection.tables == [] } + rescue ::ActiveRecord::StatementInvalid # e.g. `ERROR: invalid value for parameter "search_path"` + true + end + if recreate_shards if dont_create shard1.destroy shard2.destroy return [nil, nil] @@ -67,6 +72,6 @@ shard end end end end -end \ No newline at end of file +end