From 0a76c36a2248c75d30576a15fc60019f7dfc691e Mon Sep 17 00:00:00 2001 From: Richard Towers Date: Thu, 1 Aug 2024 16:42:07 +0100 Subject: [PATCH] Stub prometheus gauge in tests --- test/integration/fact_check_email_test.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/integration/fact_check_email_test.rb b/test/integration/fact_check_email_test.rb index dd39cff0c..94763603c 100644 --- a/test/integration/fact_check_email_test.rb +++ b/test/integration/fact_check_email_test.rb @@ -27,7 +27,7 @@ def assert_correct_state(key, value, state) message[key] = value Mail.stubs(:all).yields(message) - FactCheckEmailHandler.new(fact_check_config).process + FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)).process answer.reload assert answer.public_send("#{state}?") @@ -41,7 +41,7 @@ def assert_correct_state(key, value, state) answer.destroy! - handler = FactCheckEmailHandler.new(fact_check_config) + handler = FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)) handler.process assert message.is_marked_for_delete? @@ -53,7 +53,7 @@ def assert_correct_state(key, value, state) message = fact_check_mail_for(answer) Mail.stubs(:all).yields(message) - handler = FactCheckEmailHandler.new(fact_check_config) + handler = FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)) handler.process answer.reload @@ -71,7 +71,7 @@ def assert_correct_state(key, value, state) Mail.stubs(:all).yields(fact_check_mail_for(answer)) - handler = FactCheckEmailHandler.new(fact_check_config) + handler = FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)) handler.process answer.reload @@ -96,7 +96,7 @@ def assert_correct_state(key, value, state) fact_check_mail_for(answer1, body: "Third Message"), ) - handler = FactCheckEmailHandler.new(fact_check_config) + handler = FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)) handler.process answer1.reload @@ -122,7 +122,7 @@ def assert_correct_state(key, value, state) Mail.stubs(:all).yields(message) - handler = FactCheckEmailHandler.new(fact_check_config) + handler = FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)) handler.process assert_not message.is_marked_for_delete? @@ -139,7 +139,7 @@ def assert_correct_state(key, value, state) Mail.stubs(:all).multiple_yields(message_cc, message_bcc) - handler = FactCheckEmailHandler.new(fact_check_config) + handler = FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)) handler.process assert message_cc.is_marked_for_delete? @@ -152,7 +152,7 @@ def assert_correct_state(key, value, state) Mail.stubs(:all).yields(message) - handler = FactCheckEmailHandler.new(fact_check_config) + handler = FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)) handler.process_message(message) assert message.is_marked_for_delete? end @@ -163,7 +163,7 @@ def assert_correct_state(key, value, state) Mail.stubs(:all).yields(message) - handler = FactCheckEmailHandler.new(fact_check_config) + handler = FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)) handler.process_message(message) assert message.is_marked_for_delete? @@ -182,7 +182,7 @@ def assert_correct_state(key, value, state) fact_check_mail_for(answer2, body: "Second Message"), ) - handler = FactCheckEmailHandler.new(fact_check_config) + handler = FactCheckEmailHandler.new(fact_check_config, stub.stubs(:set)) invocations = 0 handler.process do