summaryrefslogtreecommitdiff
path: root/test/unit/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/adapters')
-rw-r--r--test/unit/adapters/em_http_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/unit/adapters/em_http_test.rb b/test/unit/adapters/em_http_test.rb
new file mode 100644
index 0000000..659ff1b
--- /dev/null
+++ b/test/unit/adapters/em_http_test.rb
@@ -0,0 +1,25 @@
+require 'test_helper'
+require 'nickserver/adapters/em_http'
+
+class Nickserver::Adapters::EmHttpTest < Minitest::Test
+
+ def test_successful_request
+ url = 'http://url.to'
+ stub_http_request(:get, url)
+ .with(query: {key: :value})
+ .to_return status: 200, body: 'body'
+ EM.run do
+ adapter.get(url, query: {key: :value}) do |status, body|
+ assert_equal 200, status
+ assert_equal 'body', body
+ EM.stop
+ end
+ end
+ end
+
+ protected
+
+ def adapter
+ Nickserver::Adapters::EmHttp.new
+ end
+end