summaryrefslogtreecommitdiff
path: root/test/unit/couch_db/response_test.rb
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2016-06-15 14:22:08 +0200
committerGitHub <noreply@github.com>2016-06-15 14:22:08 +0200
commit3c6dc3d7b902b46b82a3d8cd38bd3fa896024beb (patch)
tree559b3998465248138b6f24a76b6b3e55e60f3986 /test/unit/couch_db/response_test.rb
parent5cad637a4a2a3de6b95ff1204fc29174e18b3124 (diff)
parent93258bd6fe6247e7af67f423243eba9808e920ee (diff)
Merge pull request #3 from azul/refactor/transport-adapters
Refactor em specifics into http adapter
Diffstat (limited to 'test/unit/couch_db/response_test.rb')
-rw-r--r--test/unit/couch_db/response_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/couch_db/response_test.rb b/test/unit/couch_db/response_test.rb
new file mode 100644
index 0000000..d44760d
--- /dev/null
+++ b/test/unit/couch_db/response_test.rb
@@ -0,0 +1,30 @@
+require 'test_helper'
+require 'file_content'
+require 'nickserver/couch_db/response'
+
+class Nickserver::CouchDB::ResponseTest < Minitest::Test
+ include FileContent
+
+ def test_404
+ response = response_for "bananas@example.org",
+ status: 404, body: "{}"
+ assert_equal 404, response.status
+ end
+
+ def test_200_with_empty_response
+ response = response_for "stompy@example.org",
+ status: 200, body: file_content(:empty_couchdb_result)
+ assert_equal 404, response.status
+ end
+
+ def test_200_with_success
+ response = response_for "blue@example.org",
+ status: 200, body: file_content(:blue_couchdb_result)
+ assert_equal 200, response.status
+ assert_equal file_content(:blue_nickserver_result), response.content
+ end
+
+ def response_for(uid, couch_response = {})
+ Nickserver::CouchDB::Response.new uid, couch_response
+ end
+end