Skip to content

Commit

Permalink
[#258] create_schema/0 fixed and test added
Browse files Browse the repository at this point in the history
  • Loading branch information
ferigis committed Aug 24, 2016
1 parent 46b4bb1 commit 75c11f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/adapter_test_helpers/sumo_basic_test_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

%% Test Cases - Helpers
-export([
create_schema/1,
find/1,
find_all/1,
find_by/1,
Expand All @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions src/sumo.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions test/sumo_basic_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 75c11f6

Please sign in to comment.