Fix mango special cursor test
diff --git a/src/mango/src/mango_cursor_special.erl b/src/mango/src/mango_cursor_special.erl
index e786953..c466b5d 100644
--- a/src/mango/src/mango_cursor_special.erl
+++ b/src/mango/src/mango_cursor_special.erl
@@ -76,13 +76,26 @@
-ifdef(TEST).
-include_lib("couch/include/couch_eunit.hrl").
-create_test() ->
+create_test_() ->
+ {
+ foreach,
+ fun() ->
+ meck:expect(couch_db, name, fun(A) when is_atom(A) -> atom_to_binary(A) end)
+ end,
+ fun(_) -> meck:unload() end,
+ [
+ ?TDEF_FE(t_create)
+ ]
+ }.
+
+t_create(_) ->
Index = #idx{type = <<"special">>, def = all_docs},
Indexes = [Index],
Ranges = [{'$gt', null, '$lt', mango_json_max}],
Trace = #{},
Selector = {[]},
Options = [{limit, limit}, {skip, skip}, {fields, fields}, {bookmark, bookmark}],
+ Stats = mango_execution_stats:stats_init(couch_db:name(db)),
Cursor =
#cursor{
db = db,
@@ -94,7 +107,8 @@
skip = skip,
fields = fields,
bookmark = bookmark,
- trace = #{sorted_index_ranges => [{Index, Ranges, 0}]}
+ trace = #{sorted_index_ranges => [{Index, Ranges, 0}]},
+ execution_stats = Stats
},
?assertEqual({ok, Cursor}, create(db, {Indexes, Trace}, Selector, Options)).