lib/switchman/test_helper.rb in switchman-1.3.10 vs lib/switchman/test_helper.rb in switchman-1.3.11

- old
+ new

@@ -1,14 +1,15 @@ module Switchman module TestHelper class << self - def recreate_persistent_test_shards(options = {}) + def recreate_persistent_test_shards(dont_create: false) # recreate the default shard (it got buhleted) if Shard.default(true).is_a?(DefaultShard) begin Shard.create!(default: true) rescue + raise unless dont_create # database doesn't exist yet, presumably cause we're creating it right now return [nil, nil] end Shard.default(true) end @@ -35,10 +36,10 @@ shard2.name = server1.config[:shard2] shard2.save! if shard2.changed? recreate_shards = shard1.activate { ::ActiveRecord::Base.connection.tables == [] } if recreate_shards - if options[:dont_create] + if dont_create shard1.destroy shard2.destroy return [nil, nil] end \ No newline at end of file