test/yao/test_client.rb in yao-0.12.0 vs test/yao/test_client.rb in yao-0.13.0
- old
+ new
@@ -6,47 +6,51 @@
def test_gen_client
cli = Yao::Client.gen_client("http://cool-api.example.com:12345/v3.0")
assert { cli.url_prefix.to_s == "http://cool-api.example.com:12345/v3.0" }
+ adapter = Faraday::Adapter::NetHttp
+ assert { cli.builder.adapter == adapter }
+
handlers = [
Faraday::Request::Accept,
Faraday::Request::UrlEncoded,
Faraday::Request::ReadOnly,
Faraday::Response::OSErrorDetector,
- FaradayMiddleware::ParseJson,
- Faraday::Adapter::NetHttp
+ FaradayMiddleware::ParseJson
]
assert { cli.builder.handlers == handlers }
end
def test_gen_with_token
cli = Yao::Client.gen_client("http://cool-api.example.com:12345/v3.0", token: "deadbeaf")
+ adapter = Faraday::Adapter::NetHttp
+ assert { cli.builder.adapter == adapter }
handlers = [
Faraday::Request::Accept,
Faraday::Request::UrlEncoded,
Faraday::Request::OSToken,
Faraday::Request::ReadOnly,
Faraday::Response::OSErrorDetector,
- FaradayMiddleware::ParseJson,
- Faraday::Adapter::NetHttp
+ FaradayMiddleware::ParseJson
]
assert { cli.builder.handlers == handlers }
end
def test_debug_mode
stub(Yao.config).debug { true }
cli = Yao::Client.gen_client("http://cool-api.example.com:12345/v3.0")
+ adapter = Faraday::Adapter::NetHttp
+ assert { cli.builder.adapter == adapter }
handlers = [
Faraday::Request::Accept,
Faraday::Request::UrlEncoded,
Faraday::Request::ReadOnly,
Faraday::Response::OSErrorDetector,
FaradayMiddleware::ParseJson,
Faraday::Response::Logger,
- Faraday::Response::OSDumper,
- Faraday::Adapter::NetHttp
+ Faraday::Response::OSDumper
]
assert { cli.builder.handlers == handlers }
end
def test_timeout