Business intelligence made simple
Improved tests
Andrew Kane744361cfaa2b
diff --git a/Gemfile b/Gemfileindex a7c98c1b..6e5cef51 100644--- a/Gemfile+++ b/Gemfile@@ -6,5 +6,5 @@ gem "rake"gem "minitest", ">= 5"gem "combustion"gem "rails"-gem "sqlite3"+gem "pg"gem "sprockets-rails"diff --git a/test/charts_test.rb b/test/charts_test.rbindex 1af893d2..6c09afd7 100644--- a/test/charts_test.rb+++ b/test/charts_test.rb@@ -1,10 +1,9 @@require_relative "test_helper"class ChartsTest < ActionDispatch::IntegrationTest- # TODO fix castingdef test_line_chart- run_query "SELECT date('now'), 1"- # assert_match "LineChart", response.body+ run_query "SELECT NOW(), 1"+ assert_match "LineChart", response.bodyenddef test_column_chart_format1@@ -43,18 +42,18 @@ class ChartsTest < ActionDispatch::IntegrationTestassert_match "map", response.bodyend- # TODO updatedef test_target- run_query "SELECT date('now'), 1, 2 AS target"+ run_query "SELECT NOW(), 1, 2 AS target"+ assert_match %{"name":"target"}, response.bodyenddef test_cohort_analysis- run_query "SELECT 1 AS user_id, date('now') AS conversion_time /* cohort analysis */"- assert_match "This data source does not support cohort analysis", response.body+ run_query "SELECT 1 AS user_id, NOW() AS conversion_time /* cohort analysis */", query_id: 1+ assert_match "1 cohort", response.bodyend- def run_query(statement)- post blazer.run_queries_path, params: {statement: statement, data_source: "main"}, xhr: true+ def run_query(statement, query_id: nil)+ post blazer.run_queries_path, params: {statement: statement, data_source: "main", query_id: query_id}, xhr: trueassert_response :successendenddiff --git a/test/controller_test.rb b/test/controller_test.rbindex 04f4bd78..7d26cc45 100644--- a/test/controller_test.rb+++ b/test/controller_test.rb@@ -27,9 +27,10 @@ class ControllerTest < ActionDispatch::IntegrationTestassert_equal query.data_source, audit.data_sourceend- # TODO switch to postgres and check table namesdef test_tablesget blazer.tables_queries_path(data_source: "main")assert_response :success+ expected = ["ar_internal_metadata", "blazer_audits", "blazer_checks", "blazer_dashboard_queries", "blazer_dashboards", "blazer_queries", "schema_migrations"]+ assert_equal expected, JSON.parse(response.body).map { |v| v["table"] }endenddiff --git a/test/internal/config/blazer.yml b/test/internal/config/blazer.ymlindex 79706fb2..860859ce 100644--- a/test/internal/config/blazer.yml+++ b/test/internal/config/blazer.yml@@ -2,7 +2,7 @@data_sources:main:- url: "sqlite3::memory:"+ url: postgres://localhost/blazer_test# statement timeout, in seconds# none by defaultdiff --git a/test/internal/config/database.yml b/test/internal/config/database.ymlindex b9781191..c6ae3c2a 100644--- a/test/internal/config/database.yml+++ b/test/internal/config/database.yml@@ -1,3 +1,3 @@test:- adapter: sqlite3- database: db/combustion_test.sqlite+ adapter: postgresql+ database: blazer_test