summaryrefslogtreecommitdiff
path: root/test/integration/couch_db/source_test.rb
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-05-25 13:13:30 +0200
committerAzul <azul@riseup.net>2016-05-25 14:13:30 +0200
commit8a81429f0eb8aa5041d47557d0c5b5359bb959e6 (patch)
tree10f5d3db69883c685408edc3365d1e762f13e322 /test/integration/couch_db/source_test.rb
parent5c0fa0fb7b10820f2956807cb457421bf1e00708 (diff)
copy over all files from rewritten attempt
I started a nickserver from scratch to implement the things that are independent of our choice of stack (eventmachine or other). This commit copies them over and tests both things in parallel.
Diffstat (limited to 'test/integration/couch_db/source_test.rb')
-rw-r--r--test/integration/couch_db/source_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/integration/couch_db/source_test.rb b/test/integration/couch_db/source_test.rb
new file mode 100644
index 0000000..9e319f4
--- /dev/null
+++ b/test/integration/couch_db/source_test.rb
@@ -0,0 +1,29 @@
+require 'test_helper'
+require 'file_content'
+require 'nickserver/couch_db/source'
+
+module Nickserver::CouchDB
+ class SourceTest < Minitest::Test
+ include FileContent
+
+ class TestAdapter
+ def initialize(status, content)
+ @status = status
+ @content = content
+ end
+
+ def get(url, opts)
+ yield @status, @content
+ end
+ end
+
+ def test_couch_query_and_response
+ adapter = TestAdapter.new 200, file_content(:blue_couchdb_result)
+ source = Source.new adapter
+ source.query 'blue@example.org' do |response|
+ assert_equal 200, response.status
+ assert_equal file_content(:blue_nickserver_result), response.content
+ end
+ end
+ end
+end