diff options
Diffstat (limited to 'test/elixir/test/all_docs_test.exs')
-rw-r--r-- | test/elixir/test/all_docs_test.exs | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/test/elixir/test/all_docs_test.exs b/test/elixir/test/all_docs_test.exs index 21dcb616b..b8f21e7c0 100644 --- a/test/elixir/test/all_docs_test.exs +++ b/test/elixir/test/all_docs_test.exs @@ -46,7 +46,8 @@ defmodule AllDocsTest do # Confirm that queries may assume raw collation resp = - Couch.get("/#{db_name}/_all_docs", + Couch.get( + "/#{db_name}/_all_docs", query: %{ :startkey => "\"org.couchdb.user:\"", :endkey => "\"org.couchdb.user;\"" @@ -68,9 +69,12 @@ defmodule AllDocsTest do assert Couch.delete("/#{db_name}/1", query: %{:rev => doc1["_rev"]}).body["ok"] changes = Couch.get("/#{db_name}/_changes").body["results"] assert length(changes) == 4 - deleted = Enum.filter(changes, fn row -> row["deleted"] end) - assert length(deleted) == 1 - assert hd(deleted)["id"] == "1" + + retry_until(fn -> + deleted = Enum.filter(changes, fn row -> row["deleted"] end) + assert length(deleted) == 1 + assert hd(deleted)["id"] == "1" + end) # (remember old seq) orig_doc = Enum.find(changes, fn row -> row["id"] == "3" end) @@ -99,7 +103,8 @@ defmodule AllDocsTest do # Test _all_docs with keys rows = - Couch.post("/#{db_name}/_all_docs", + Couch.post( + "/#{db_name}/_all_docs", query: %{:include_docs => true}, body: %{:keys => ["1"]} ).body["rows"] @@ -124,18 +129,23 @@ defmodule AllDocsTest do :value => "Z" } - assert Couch.put("/#{db_name}/3", query: %{:new_edits => false}, body: conflicted_doc1).body[ - "ok" - ] + assert Couch.put( + "/#{db_name}/3", + query: %{:new_edits => false}, + body: conflicted_doc1 + ).body["ok"] - assert Couch.put("/#{db_name}/3", query: %{:new_edits => false}, body: conflicted_doc2).body[ - "ok" - ] + assert Couch.put( + "/#{db_name}/3", + query: %{:new_edits => false}, + body: conflicted_doc2 + ).body["ok"] win_rev = Couch.get("/#{db_name}/3").body changes = - Couch.get("/#{db_name}/_changes", + Couch.get( + "/#{db_name}/_changes", query: %{:include_docs => true, :conflicts => true, :style => "all_docs"} ).body["results"] @@ -147,7 +157,8 @@ defmodule AllDocsTest do assert length(doc3["doc"]["_conflicts"]) == 2 rows = - Couch.get("/#{db_name}/_all_docs", + Couch.get( + "/#{db_name}/_all_docs", query: %{:include_docs => true, :conflicts => true} ).body["rows"] @@ -166,7 +177,8 @@ defmodule AllDocsTest do assert Couch.post("/#{db_name}", body: %{:_id => "a", :foo => "a"}).body["ok"] rows = - Couch.get("/#{db_name}/_all_docs", + Couch.get( + "/#{db_name}/_all_docs", query: %{:startkey => "\"Z\"", :endkey => "\"Z\""} ).body["rows"] |