summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-07-02 12:03:46 +0200
committerAzul <azul@riseup.net>2016-07-02 12:03:46 +0200
commitfb2d7e6f8f1fceefbc8964d34369a867eb8f25bb (patch)
tree672ea8bbf03876d65c90ecb1ed152424e74939e1 /test/integration
parent8a664a39bc3dd77a9c53fa5931f81c2b2b8b7295 (diff)
refactor: replace blocks/yields with returns
This became possible because we now use celluloid. Celluloid handles asynchronity without the need for callbacks or blocks.
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/couch_db/source_test.rb8
-rw-r--r--test/integration/nickserver_test.rb7
2 files changed, 12 insertions, 3 deletions
diff --git a/test/integration/couch_db/source_test.rb b/test/integration/couch_db/source_test.rb
index 21e3642..cb1153e 100644
--- a/test/integration/couch_db/source_test.rb
+++ b/test/integration/couch_db/source_test.rb
@@ -1,6 +1,5 @@
require 'test_helper'
require 'file_content'
-require 'helpers/test_adapter'
require 'nickserver/couch_db/source'
module Nickserver::CouchDB
@@ -8,12 +7,17 @@ module Nickserver::CouchDB
include FileContent
def test_couch_query_and_response
- adapter = TestAdapter.new 200, file_content(:blue_couchdb_result)
+ adapter = adapter_returns 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
+
+ def adapter_returns(*return_values)
+ adapter = Minitest::Mock.new
+ adapter.expect :get, return_values, [String, Hash]
+ end
end
end
diff --git a/test/integration/nickserver_test.rb b/test/integration/nickserver_test.rb
index d179d7e..710c3a1 100644
--- a/test/integration/nickserver_test.rb
+++ b/test/integration/nickserver_test.rb
@@ -18,7 +18,12 @@ class NickserverTest < Minitest::Test
def setup
super
- Celluloid.shutdown; Celluloid.boot
+ Celluloid.boot
+ end
+
+ def teardown
+ Celluloid.shutdown
+ super
end
def test_GET_served_via_SKS