Business intelligence made simple
Improved adapter tests [skip ci]
Andrew Kane829b0c3c6b9a
diff --git a/test/adapters/cassandra_test.rb b/test/adapters/cassandra_test.rbindex 7223cd6c..4a7a39e1 100644--- a/test/adapters/cassandra_test.rb+++ b/test/adapters/cassandra_test.rb@@ -8,6 +8,7 @@ class CassandraTest < ActionDispatch::IntegrationTestenddef setup+ super@@once ||= beginrequire "cassandra"cluster = Cassandra.cluster(hosts: ["localhost"])diff --git a/test/adapters/influxdb_test.rb b/test/adapters/influxdb_test.rbindex 72b1103b..922089b2 100644--- a/test/adapters/influxdb_test.rb+++ b/test/adapters/influxdb_test.rb@@ -8,6 +8,7 @@ class InfluxdbTest < ActionDispatch::IntegrationTestenddef setup+ super@@once ||= beginclient = InfluxDB::Client.new(url: "http://localhost:8086/blazer_test")client.delete_series("items")diff --git a/test/adapters/postgresql_test.rb b/test/adapters/postgresql_test.rbindex ca27078e..24c030fa 100644--- a/test/adapters/postgresql_test.rb+++ b/test/adapters/postgresql_test.rb@@ -7,6 +7,15 @@ class PostgresqlTest < ActionDispatch::IntegrationTest"postgresql"end+ def setup+ super+ @@once ||= begin+ execute "CREATE VIEW users_view AS SELECT * FROM users"+ execute "CREATE MATERIALIZED VIEW users_matview AS SELECT * FROM users"+ true+ end+ end+def test_runassert_result [{"hello" => "world"}], "SELECT 'world' AS hello"end@@ -85,7 +94,6 @@ class PostgresqlTest < ActionDispatch::IntegrationTestenddef test_tables_method- setup_viewstables = ds.tables.map { |v| v[:table] }assert_includes tables, "users"assert_includes tables, "users_view"@@ -94,7 +102,6 @@ class PostgresqlTest < ActionDispatch::IntegrationTestenddef test_schema_method- setup_viewsschema = ds.schematables = schema.map { |v| v[:table] }assert_includes tables, "users"@@ -102,14 +109,4 @@ class PostgresqlTest < ActionDispatch::IntegrationTest# TODO addrefute_includes tables, "users_matview"end-- private-- def setup_views- @@setup_views ||= begin- execute "CREATE VIEW users_view AS SELECT * FROM users"- execute "CREATE MATERIALIZED VIEW users_matview AS SELECT * FROM users"- true- end- endenddiff --git a/test/adapters/sqlite_test.rb b/test/adapters/sqlite_test.rbindex 7c900e3b..ad6398e9 100644--- a/test/adapters/sqlite_test.rb+++ b/test/adapters/sqlite_test.rb@@ -7,6 +7,15 @@ class SqliteTest < ActionDispatch::IntegrationTest"sqlite"end+ def setup+ super+ @@once ||= begin+ execute "CREATE TABLE users (id integer)"+ execute "CREATE VIEW users_view AS SELECT * FROM users"+ true+ end+ end+def test_runassert_result [{"hello" => "world"}], "SELECT 'world' AS hello"end@@ -53,27 +62,15 @@ class SqliteTest < ActionDispatch::IntegrationTestdef test_tables_method- setup_tablestables = ds.tablesassert_includes tables, "users"assert_includes tables, "users_view"enddef test_schema_method- setup_tablesschema = ds.schematables = schema.map { |v| v[:table] }assert_includes tables, "users"assert_includes tables, "users_view"end-- private-- def setup_tables- @@setup_tables ||= begin- execute "CREATE TABLE users (id integer)"- execute "CREATE VIEW users_view AS SELECT * FROM users"- true- end- endend