lib/switchman/test_helper.rb in switchman-0.0.1 vs lib/switchman/test_helper.rb in switchman-1.0.0
- old
+ new
@@ -1,11 +1,11 @@
module Switchman
module TestHelper
class << self
def recreate_persistent_test_shards
# recreate the default shard (it got buhleted)
- if Shard.default.is_a?(DefaultShard)
+ if Shard.default(true).is_a?(DefaultShard)
begin
Shard.create!(:default => true)
rescue
# database doesn't exist yet, presumably
[nil, nil]
@@ -50,12 +50,12 @@
end
private
def find_existing_test_shard(server, name)
if server == Shard.default.database_server
- server.shards.find_by_database_name(name)
+ server.shards.where(name: name).first
else
- shard = Shard.where("database_server_id IS NOT NULL AND database_name=?", name).first
+ shard = Shard.where("database_server_id IS NOT NULL AND name=?", name).first
# if somehow databases got created in a different order, change the shard to match
shard.database_server = server if shard
shard
end
end
\ No newline at end of file