anchor.diff:      view_cleanup(DbName),
       ?_assertEqual(0, count_index_files(DbName)).
   
  +
  +create_doc(DbName) ->
  +    {ok, Db} = couch_db:open(DbName, [?ADMIN_USER]),
  +    Doc666 = couch_doc:from_json_obj({[
  +        {<<"_id">>, <<"doc666">>},
  +        {<<"value">>, 999}
  +
  +    ]}),
  +    {ok, _} = couch_db:update_docs(Db, [Doc666]),
  +    couch_db:ensure_full_commit(Db),
  +    couch_db:close(Db).
  +
  +create_docs(DbName) ->
  +    {ok, Db} = couch_db:open(DbName, [?ADMIN_USER]),
  +    Doc1 = couch_doc:from_json_obj({[
  +        {<<"_id">>, <<"doc1">>},
  +        {<<"value">>, 1}
  +
  +    ]}),
  +    Doc2 = couch_doc:from_json_obj({[
  +        {<<"_id">>, <<"doc2">>},
  +        {<<"value">>, 2}
  +
  +    ]}),
  +    Doc3 = couch_doc:from_json_obj({[
  +        {<<"_id">>, <<"doc3">>},
  +        {<<"value">>, 3}
  +
  +    ]}),
  +    {ok, _} = couch_db:update_docs(Db, [Doc1, Doc2, Doc3]),
  +    couch_db:ensure_full_commit(Db),
  +    couch_db:close(Db).
   
   create_design_doc(DbName, DDName, ViewName) ->
       {ok, Db} = couch_db:open(DbName, [?ADMIN_USER]),
  
positive.code:     RootDir = couch_config:get("couchdb", "view_index_dir"),
      length(filelib:wildcard(RootDir ++ "/." ++
          binary_to_list(DbName) ++ "_design"++"/mrview/*")).
  
negative.code:     DbName = ?tempdb(),
      {ok, _} = couch_db:create(DbName, [?ADMIN_USER]),
      FooRev = create_design_doc(DbName, <<"_design/foo">>, <<"bar">>),
      query_view(DbName, "foo", "bar"),
      BooRev = create_design_doc(DbName, <<"_design/boo">>, <<"baz">>),
      query_view(DbName, "boo", "baz"),
      {DbName, {FooRev, BooRev}}.
  
  setup_with_docs() ->
      DbName = ?tempdb(),
      {ok, _} = couch_db:create(DbName, [?ADMIN_USER]),
      create_docs(DbName),
      create_design_doc(DbName, <<"_design/foo">>, <<"bar">>),
      DbName.
  
  teardown({DbName, _}) ->
      teardown(DbName);
  teardown(DbName) when is_binary(DbName) ->
      ok = couch_server:delete(DbName, [?ADMIN_USER]),
      ok.
  
  
  