From ec875169b0231d84bb8c55bbe91c52b896561f1e Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 12 Sep 2016 16:34:25 +0200 Subject: test: separate remote tests into own directory Dropped the webmock dependency. We have our own http adapter. So we can stub that to inject a mock. As an added bonus this does not mess with other http requests. Also wrote down testing strategy. Not completely implemented yet. --- test/unit/adapters/celluloid_http_test.rb | 48 ------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 test/unit/adapters/celluloid_http_test.rb (limited to 'test/unit') diff --git a/test/unit/adapters/celluloid_http_test.rb b/test/unit/adapters/celluloid_http_test.rb deleted file mode 100644 index 68b9606..0000000 --- a/test/unit/adapters/celluloid_http_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'test_helper' -require 'nickserver/adapters/celluloid_http' - -class Nickserver::Adapters::CelluloidHttpTest < Minitest::Test - - def setup - super - Celluloid.boot - end - - def teardown - Celluloid.shutdown - super - end - - def test_request_without_query - url = 'http://url.to' - stub_http_request(:get, url) - .to_return status: 200, body: 'body' - status, body = adapter.get url - assert_equal 200, status - assert_equal 'body', body - end - - def test_successful_request_with_query - url = 'http://url.to' - stub_http_request(:get, url) - .with(query: {key: :value}) - .to_return status: 200, body: 'body' - status, body = adapter.get(url, query: {key: :value}) - assert_equal 200, status - assert_equal 'body', body - end - - def test_https_for_hkp - url = Nickserver::Config.hkp_url - real_network do - status, _body = adapter.get url - assert_equal 404, status - end - end - - protected - - def adapter - @adapter ||= Nickserver::Adapters::CelluloidHttp.new - end -end -- cgit v1.2.3