From e3a7da49029b814aaddff5b3a01cbf01dfceb9c3 Mon Sep 17 00:00:00 2001 From: Yuri Rudman Date: Tue, 11 Sep 2018 15:16:16 -0400 Subject: [PATCH] added test coverage for methods queued from UI --- spec/replication/util/miq_pglogical_spec.rb | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spec/replication/util/miq_pglogical_spec.rb b/spec/replication/util/miq_pglogical_spec.rb index cb7be850c2a1..a73976a9aede 100644 --- a/spec/replication/util/miq_pglogical_spec.rb +++ b/spec/replication/util/miq_pglogical_spec.rb @@ -142,4 +142,26 @@ expect(described_class.node_name_to_region("region_5")).to eq(5) end end + + describe ".save_replication_type" do + it "update replication type for this region" do + expect(MiqRegion).to receive(:replication_type=).with(:remote) + described_class.save_replication_type(:remote) + end + end + + describe ".save_remote_region" do + it "sets replication type for this region to 'remote'" do + allow(described_class).to receive(:refresh_excludes) + expect(described_class).to receive(:save_replication_type).with(:remote) + described_class.save_remote_region("") + end + + it "updates list of tables to be excluded from replication" do + tables = "---\n- vmdb_databases\n- vmdb_indexes\n- vmdb_metrics\n- vmdb_tables\n" + allow(described_class).to receive(:save_replication_type).with(:remote) + expect(described_class).to receive(:refresh_excludes).with(YAML.safe_load(tables)) + described_class.save_remote_region(tables) + end + end end