@@ -37,7 +37,6 @@ defmodule BypassTest do
3737 defp specify_port ( port , expect_fun ) do
3838 bypass = Bypass . open ( port: port )
3939
40- # one of Bypass.expect or Bypass.expect_once
4140 apply ( Bypass , expect_fun , [
4241 bypass ,
4342 fn conn ->
@@ -62,7 +61,6 @@ defmodule BypassTest do
6261 defp down_socket ( expect_fun ) do
6362 bypass = Bypass . open ( )
6463
65- # one of Bypass.expect or Bypass.expect_once
6664 apply ( Bypass , expect_fun , [
6765 bypass ,
6866 fn conn -> Plug.Conn . send_resp ( conn , 200 , "" ) end
@@ -101,13 +99,12 @@ defmodule BypassTest do
10199 defp not_called ( expect_fun ) do
102100 bypass = Bypass . open ( )
103101
104- # one of Bypass.expect or Bypass.expect_once
105102 apply ( Bypass , expect_fun , [
106103 bypass ,
107104 fn _conn -> assert false end
108105 ] )
109106
110- # Override Bypass' on_exit handler
107+ # Override Bypass' on_exit handler.
111108 ExUnit.Callbacks . on_exit ( { Bypass , bypass . pid } , fn ->
112109 exit_result = Bypass.Instance . call ( bypass . pid , :on_exit )
113110 assert { :error , :not_called , { :any , :any } } = exit_result
@@ -125,7 +122,6 @@ defmodule BypassTest do
125122 defp pass ( expect_fun ) do
126123 bypass = Bypass . open ( )
127124
128- # one of Bypass.expect or Bypass.expect_once
129125 apply ( Bypass , expect_fun , [
130126 bypass ,
131127 fn _conn ->
@@ -152,11 +148,10 @@ defmodule BypassTest do
152148 defp closing_in_flight ( expect_fun ) do
153149 bypass = Bypass . open ( )
154150
155- # one of Bypass.expect or Bypass.expect_once
156151 apply ( Bypass , expect_fun , [
157152 bypass ,
158153 fn _conn ->
159- # mark the request as arrived, since we're shutting it down now
154+ # Mark the request as arrived, since we're shutting it down now.
160155 Bypass . pass ( bypass )
161156 Bypass . down ( bypass )
162157 end
@@ -179,7 +174,6 @@ defmodule BypassTest do
179174 ref = make_ref ( )
180175 bypass = Bypass . open ( )
181176
182- # one of Bypass.expect or Bypass.expect_once
183177 apply ( Bypass , expect_fun , [
184178 bypass ,
185179 fn conn ->
@@ -192,8 +186,8 @@ defmodule BypassTest do
192186
193187 assert { :ok , 200 , "" } = request ( bypass . port )
194188
195- # Here we make sure that Bypass.down waits until the plug process finishes its work
196- # before shutting down
189+ # Here we make sure that Bypass.down waits until the plug process finishes
190+ # its work before shutting down.
197191 refute_received ^ ref
198192 Bypass . down ( bypass )
199193 assert_received ^ ref
@@ -236,8 +230,8 @@ defmodule BypassTest do
236230 end )
237231 end )
238232
239- # Here we make sure that Bypass.down waits until the plug process finishes its work
240- # before shutting down
233+ # Here we make sure that Bypass.down waits until the plug process finishes
234+ # its work before shutting down.
241235 refute_received ^ ref
242236 :timer . sleep ( 200 )
243237 Bypass . down ( bypass )
@@ -256,7 +250,7 @@ defmodule BypassTest do
256250 assert { :ok , 500 , "" } = request ( bypass . port )
257251 end )
258252
259- # Override Bypass' on_exit handler
253+ # Override Bypass' on_exit handler.
260254 ExUnit.Callbacks . on_exit ( { Bypass , bypass . pid } , fn ->
261255 exit_result = Bypass.Instance . call ( bypass . pid , :on_exit )
262256 assert { :error , :unexpected_request , { :any , :any } } = exit_result
@@ -282,7 +276,7 @@ defmodule BypassTest do
282276 assert_receive :request_received
283277 end )
284278
285- # Override Bypass' on_exit handler
279+ # Override Bypass' on_exit handler.
286280 ExUnit.Callbacks . on_exit ( { Bypass , bypass . pid } , fn ->
287281 :ok == Bypass.Instance . call ( bypass . pid , :on_exit )
288282 end )
@@ -303,7 +297,7 @@ defmodule BypassTest do
303297 assert_receive :request_received
304298 refute_receive :request_received
305299
306- # Override Bypass' on_exit handler
300+ # Override Bypass' on_exit handler.
307301 ExUnit.Callbacks . on_exit ( { Bypass , bypass . pid } , fn ->
308302 exit_result = Bypass.Instance . call ( bypass . pid , :on_exit )
309303 assert { :error , :too_many_requests , { :any , :any } } = exit_result
@@ -347,7 +341,6 @@ defmodule BypassTest do
347341 method = "POST"
348342 path = "/this"
349343
350- # one of Bypass.expect or Bypass.expect_once
351344 apply ( Bypass , expect_fun , [
352345 bypass ,
353346 method ,
@@ -382,7 +375,6 @@ defmodule BypassTest do
382375 pattern = "/this/:resource/get/:id"
383376 path = "/this/my_resource/get/1234"
384377
385- # one of Bypass.expect or Bypass.expect_once
386378 apply ( Bypass , expect_fun , [
387379 bypass ,
388380 method ,
@@ -421,7 +413,6 @@ defmodule BypassTest do
421413 paths = [ "/this" , "/that" ]
422414
423415 Enum . each ( paths , fn path ->
424- # one of Bypass.expect or Bypass.expect_once
425416 apply ( Bypass , expect_fun , [
426417 bypass ,
427418 method ,
@@ -448,7 +439,7 @@ defmodule BypassTest do
448439 @ doc ~S"""
449440 Open a new HTTP connection and perform the request. We don't want to use httpc, hackney or another
450441 "high-level" HTTP client, since they do connection pooling and we will sometimes get a connection
451- closed error and not a failed to connect error, when we test Bypass.down
442+ closed error and not a failed to connect error, when we test Bypass.down.
452443 """
453444 def request ( port , path \\ "/example_path" , method \\ "POST" ) do
454445 with { :ok , conn } <- Mint.HTTP . connect ( :http , "127.0.0.1" , port ) ,
@@ -490,11 +481,11 @@ defmodule BypassTest do
490481 end
491482 end
492483
493- test "Bypass.expect/4 can be used to define a specific route and then redefined " do
484+ test "Bypass.expect/4 can be used to define a specific route and then redefine it later " do
494485 :expect |> specific_route_redefined
495486 end
496487
497- test "Bypass.expect_once/4 can be used to define a specific route and then redefined " do
488+ test "Bypass.expect_once/4 can be used to define a specific route and then redefine it later " do
498489 :expect_once |> specific_route_redefined
499490 end
500491
@@ -503,7 +494,6 @@ defmodule BypassTest do
503494 method = "POST"
504495 path = "/this"
505496
506- # one of Bypass.expect or Bypass.expect_once
507497 apply ( Bypass , expect_fun , [
508498 bypass ,
509499 method ,
@@ -519,7 +509,7 @@ defmodule BypassTest do
519509 assert { :ok , 200 , "" } = request ( bypass . port , path )
520510 end )
521511
522- # redefining the expect
512+ # Redfine the expect
523513 apply ( Bypass , expect_fun , [
524514 bypass ,
525515 method ,
0 commit comments