From 75c11f6370eab3f805a6e55794f47d0065e7a3dc Mon Sep 17 00:00:00 2001 From: Felipe Ripoll Date: Wed, 24 Aug 2016 08:49:59 -0600 Subject: [PATCH] [#258] create_schema/0 fixed and test added --- src/adapter_test_helpers/sumo_basic_test_helper.erl | 9 +++++++++ src/sumo.erl | 4 ++-- test/sumo_basic_SUITE.erl | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/adapter_test_helpers/sumo_basic_test_helper.erl b/src/adapter_test_helpers/sumo_basic_test_helper.erl index c5d3445..e743d6a 100644 --- a/src/adapter_test_helpers/sumo_basic_test_helper.erl +++ b/src/adapter_test_helpers/sumo_basic_test_helper.erl @@ -2,6 +2,7 @@ %% Test Cases - Helpers -export([ + create_schema/1, find/1, find_all/1, find_by/1, @@ -17,6 +18,14 @@ %%% Test Cases - Helpers %%%============================================================================= +-spec create_schema(config()) -> ok. +create_schema(Config) -> + ok = sumo:create_schema(), + Tables = mnesia:system_info(tables), + {_, Name} = lists:keyfind(name, 1, Config), + true = lists:member(Name, Tables), + ok. + -spec find(config()) -> ok. find(Config) -> {_, Name} = lists:keyfind(name, 1, Config), diff --git a/src/sumo.erl b/src/sumo.erl index 010ca96..63a22ce 100644 --- a/src/sumo.erl +++ b/src/sumo.erl @@ -119,8 +119,8 @@ get_docs() -> %% @doc Creates the schema for all known (configured) docs. -spec create_schema() -> ok. create_schema() -> - lists:foreach(fun({DocName, Store}) -> - create_schema(DocName, Store) + lists:foreach(fun({DocName, _, _}) -> + create_schema(DocName) end, get_docs()). %% @doc Returns 1 doc that matches the given Conditions. diff --git a/test/sumo_basic_SUITE.erl b/test/sumo_basic_SUITE.erl index 8fcab93..160422a 100644 --- a/test/sumo_basic_SUITE.erl +++ b/test/sumo_basic_SUITE.erl @@ -12,6 +12,7 @@ -include_lib("mixer/include/mixer.hrl"). -mixin([ {sumo_basic_test_helper, [ + create_schema/1, find/1, find_all/1, find_by/1,