Business intelligence made simple
Removed stub calls for minitest 6 [skip ci]
Andrew Kanecda46c59d283
diff --git a/test/anomaly_checks_test.rb b/test/anomaly_checks_test.rbindex 2066aee1..72ce98ad 100644--- a/test/anomaly_checks_test.rb+++ b/test/anomaly_checks_test.rb@@ -25,7 +25,7 @@ class AnomalyChecksTest < ActionDispatch::IntegrationTestdef assert_anomaly(anomaly_checks)skip if !postgresql? || RUBY_ENGINE == "truffleruby"- Blazer.stub(:anomaly_checks, anomaly_checks) do+ with_option(:anomaly_checks, anomaly_checks) doquery = create_query(statement: "SELECT current_date + n AS day, 0.1 FROM generate_series(1, 30) n")check = create_check(query: query, check_type: "anomaly")diff --git a/test/cache_test.rb b/test/cache_test.rbindex 3428ac09..14e40446 100644--- a/test/cache_test.rb+++ b/test/cache_test.rb@@ -44,8 +44,12 @@ class CacheTest < ActionDispatch::IntegrationTestprivatedef with_caching(value)- Blazer.data_sources["main"].stub(:cache, value) do+ data_source = Blazer.data_sources["main"]+ begin+ data_source.instance_variable_set(:@cache, value)yield+ ensure+ data_source.remove_instance_variable(:@cache)endendenddiff --git a/test/forecasting_test.rb b/test/forecasting_test.rbindex 433ae13d..a9883097 100644--- a/test/forecasting_test.rb+++ b/test/forecasting_test.rb@@ -20,7 +20,7 @@ class ForecastingTest < ActionDispatch::IntegrationTestdef assert_forecast(forecasting)skip unless postgresql?- Blazer.stub(:forecasting, forecasting) do+ with_option(:forecasting, forecasting) doquery = create_query(statement: "SELECT current_date + n AS day, n FROM generate_series(1, 30) n")run_query query.statement, query_id: query.id, forecast: "t"assert_match %{"name":"forecast"}, response.bodydiff --git a/test/queries_test.rb b/test/queries_test.rbindex 6b491ca1..1a5a31b9 100644--- a/test/queries_test.rb+++ b/test/queries_test.rb@@ -164,14 +164,14 @@ class QueriesTest < ActionDispatch::IntegrationTestenddef test_images- Blazer.stub(:images, true) do+ with_option(:images, true) dorun_query("SELECT 'http://localhost:3000/image.png'")assert_match %{<img referrerpolicy="no-referrer" src="http://localhost:3000/image.png" }, response.bodyendenddef test_async- Blazer.stub(:async, true) do+ with_option(:async, true) doperform_enqueued_jobs dorun_query "SELECT 123"enddiff --git a/test/test_helper.rb b/test/test_helper.rbindex f13ced2a..f7e9cbcc 100644--- a/test/test_helper.rb+++ b/test/test_helper.rb@@ -37,6 +37,16 @@ class ActionDispatch::IntegrationTestdef postgresql?ENV["ADAPTER"].nil?end++ def with_option(name, value)+ previous_value = Blazer.send(name)+ begin+ Blazer.send("#{name}=", value)+ yield+ ensure+ Blazer.send("#{name}=", previous_value)+ end+ endendrequire_relative "support/adapter_test"