File tree 1 file changed +18
-4
lines changed
1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 21
21
require 'async/http/faraday'
22
22
require 'async/http/server'
23
23
require 'async/http/endpoint'
24
- require 'async/reactor'
24
+
25
+ require 'async'
25
26
26
27
RSpec . describe Async ::HTTP ::Faraday ::Adapter do
27
28
let ( :endpoint ) {
35
36
36
37
server = Async ::HTTP ::Server . new ( app , endpoint )
37
38
38
- Async :: Reactor . run do |task |
39
+ Async do |task |
39
40
server_task = task . async do
40
41
server . run
41
42
end
42
43
43
- conn = Faraday . new ( :url => endpoint . url ) do |faraday |
44
+ connection = Faraday . new ( :url => endpoint . url ) do |faraday |
44
45
faraday . response :logger
45
46
faraday . adapter :async_http
46
47
end
47
48
48
- response = conn . get ( "/index" )
49
+ response = connection . get ( "/index" )
49
50
50
51
expect ( response . body ) . to be == "Hello World"
51
52
52
53
server_task . stop
53
54
end
54
55
end
56
+
57
+ it "can get remote resource" do
58
+ Async do |task |
59
+ connection = Faraday . new ( :url => "http://www.google.com" ) do |faraday |
60
+ faraday . response :logger
61
+ faraday . adapter :async_http
62
+ end
63
+
64
+ response = connection . get ( "/search?q=cats" )
65
+
66
+ expect ( response ) . to be_success
67
+ end
68
+ end
55
69
end
You can’t perform that action at this time.
0 commit comments