From 30d2f9e4adee845145f3b8565cd83fb06d31ae81 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Sun, 18 May 2025 21:43:45 +0200 Subject: [PATCH] FIX: attempts to fix flaky in stat spec I suspect that by having an integer and not a float sometimes the value we get is converted to 0. This is the error we have atm: ``` Failure/Error: measurement = Benchmark.measure { example.run } expected: 0.75 got: 0.0 (compared using ==) ``` This might not fix it, but it feels right to make this change. --- plugins/automation/spec/models/stat_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/automation/spec/models/stat_spec.rb b/plugins/automation/spec/models/stat_spec.rb index f221db60952bf..475c927c183e6 100644 --- a/plugins/automation/spec/models/stat_spec.rb +++ b/plugins/automation/spec/models/stat_spec.rb @@ -146,7 +146,7 @@ context "with block form" do it "measures the execution time and records it" do # Mock Process.clock_gettime to return controlled values - allow(Process).to receive(:clock_gettime).and_return(10, 10.75) + allow(Process).to receive(:clock_gettime).and_return(10.0, 10.75) result = DiscourseAutomation::Stat.log(automation_id) { "test result" } @@ -162,7 +162,7 @@ context "when an error occurs" do it "yields the correct error and records it" do - allow(Process).to receive(:clock_gettime).and_return(10, 10.75) + allow(Process).to receive(:clock_gettime).and_return(10.0, 10.75) expect { DiscourseAutomation::Stat.log(automation_id) { raise } }.to raise_error( RuntimeError,