Skip to content

Commit 92bd8b3

Browse files
committed
ex_tldr_test: insert Mox and write a possible test
It is a "possible test" because it can not be implemented as it is, because HTTPoison does not raise the defined exception. But it is interesting to keep the test for the future implementation of the necessary behaviour to adress this issue.
1 parent 409d5c0 commit 92bd8b3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/ex_tldr_test.exs

+13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
defmodule ExTldrTest do
22
use ExUnit.Case
33
import ExUnit.CaptureIO
4+
alias ClientMock
45
doctest ExTldr
56

7+
import Mox
8+
9+
setup :verify_on_exit!
10+
611
test "look for a linux command" do
712
execute_main = fn ->
813
ExTldr.main(["linux", "adduser"])
@@ -58,4 +63,12 @@ defmodule ExTldrTest do
5863

5964
assert capture_io(execute_main) =~ "Usage:"
6065
end
66+
67+
#test "should return lack of internet" do
68+
# assert_raise NoInternetConnectionError,
69+
# fn ->
70+
# ClientMock
71+
# |> expect(:get, fn _ -> {:error, %HTTPoison.Error{reason: :nxdomain}} end)
72+
# end
73+
#end
6174
end

0 commit comments

Comments
 (0)