Skip to content

Business intelligence made simple

Improved SODA test [skip ci]

Andrew Kane762d1b517a84
diff --git a/lib/blazer/adapters/soda_adapter.rb b/lib/blazer/adapters/soda_adapter.rb
index 0604e0d3..59b15a45 100644
--- a/lib/blazer/adapters/soda_adapter.rb
+++ b/lib/blazer/adapters/soda_adapter.rb
@@ -2,6 +2,10 @@ module Blazer
module Adapters
class SodaAdapter < BaseAdapter
def run_statement(statement, comment)
+ require "json"
+ require "net/http"
+ require "uri"
+
columns = []
rows = []
error = nil
diff --git a/test/adapters/soda_test.rb b/test/adapters/soda_test.rb
index 806ee49a..483d0097 100644
--- a/test/adapters/soda_test.rb
+++ b/test/adapters/soda_test.rb
@@ -6,4 +6,12 @@ class SodaTest < ActionDispatch::IntegrationTest
def data_source
"soda"
end
+
+ def test_tables
+ assert_equal ["all"], tables
+ end
+
+ def test_run
+ assert_result [{"hello" => "world"}], "SELECT 'world' AS hello LIMIT 1"
+ end
end
diff --git a/test/support/adapter_test.rb b/test/support/adapter_test.rb
index 812618a3..1d2b5747 100644
--- a/test/support/adapter_test.rb
+++ b/test/support/adapter_test.rb
@@ -1,12 +1,16 @@
module AdapterTest
def test_tables
- get blazer.tables_queries_path(data_source: data_source)
- assert_response :success
- assert_kind_of Array, JSON.parse(response.body)
+ assert_kind_of Array, tables
end
private
+ def tables
+ get blazer.tables_queries_path(data_source: data_source)
+ assert_response :success
+ JSON.parse(response.body)
+ end
+
def assert_result(expected, statement)
run_query statement, data_source: data_source, format: "csv"
assert_response :success