Skip to content

Instantly share code, notes, and snippets.

@KlausTrainer
Created September 13, 2015 15:49
Show Gist options
  • Save KlausTrainer/2fb1d980cd267c6538fe to your computer and use it in GitHub Desktop.
Save KlausTrainer/2fb1d980cd267c6538fe to your computer and use it in GitHub Desktop.
diff --git a/test/couch_doc_json_tests.erl b/test/couch_doc_json_tests.erl
index 56587cd..85a931a 100644
--- a/test/couch_doc_json_tests.erl
+++ b/test/couch_doc_json_tests.erl
@@ -17,9 +17,10 @@
json_doc_test_() ->
+ TestCtx = test_util:start(?MODULE),
{
setup,
- fun() -> test_util:start(?MODULE) end, fun test_util:stop/1,
+ fun() -> TestCtx end, fun test_util:stop/1,
[
{
"Document from JSON",
@KlausTrainer
Copy link
Author

in function couch_doc_json_tests:'-from_json_error_cases/0-fun-0-'/2 (test/couch_doc_json_tests.erl, line 219)
**error:{assertMatch,
    [{module,couch_doc_json_tests},
     {line,219},
     {expression,"Error"},
     {pattern,"Expect"},
     {value,
         {'EXIT',
             {undef,
                 [{couch_epi_functions_gen_couch_db,providers,
                      [validate_docid,1],
                      []},
                  {couch_epi_functions_gen,apply,5,[...]},
                  {couch_epi,any,5,...},
                  {couch_doc,validate_docid,...},
                  {couch_doc,...},
                  {...}|...]}}}]}
  output:<<"">>

@KlausTrainer
Copy link
Author

This makes all tests pass (note that it is somehow important to have test_util:start_couch() outside of the {setup, …} tuple):

diff --git a/test/couch_doc_json_tests.erl b/test/couch_doc_json_tests.erl
index 56587cd..037886f 100644
--- a/test/couch_doc_json_tests.erl
+++ b/test/couch_doc_json_tests.erl
@@ -17,9 +17,10 @@


 json_doc_test_() ->
+    TestCtx = test_util:start_couch(),
     {
         setup,
-        fun() -> test_util:start(?MODULE) end, fun test_util:stop/1,
+        fun() -> TestCtx end, fun test_util:stop_couch/1,
         [
             {
                 "Document from JSON",

@KlausTrainer
Copy link
Author

Here's how to run the test separately:

rebar setup_eunit && BUILDDIR=$(pwd) rebar -r eunit apps=couch tests="json_doc_test"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment