@@ -15,33 +15,37 @@ defmodule NodelixTest do
1515
1616 test "run without profile" do
1717 assert ExUnit.CaptureIO . capture_io ( fn ->
18- assert Mix.Task . run ( "nodelix" , [ "--version" ] ) == :ok
18+ assert Mix.Task . rerun ( "nodelix" , [ "--version" ] ) == :ok
1919 end ) =~ @ version
2020 end
2121
2222 test "run on another profile" do
2323 assert ExUnit.CaptureIO . capture_io ( fn ->
24- assert Mix.Task . run ( "nodelix" , [ "--profile" , "another" , "--version "] ) == :ok
24+ assert Mix.Task . rerun ( "nodelix" , [ "--profile" , "test_profile " ] ) == :ok
2525 end ) =~ @ version
2626 end
2727
28- test "updates on install " do
29- Application . put_env ( :nodelix , :version , "20.9.0 " )
30- Mix.Task . rerun ( "nodelix.install" , [ "--if-missing" ] )
28+ test "installs and runs multiple versions " do
29+ Application . put_env ( :nodelix , :version , "18.18.2 " )
30+ Mix.Task . rerun ( "nodelix.install" )
3131
3232 assert ExUnit.CaptureIO . capture_io ( fn ->
33- assert Mix.Task . run ( "nodelix" , [ "--version" ] ) == :ok
34- end ) =~ "20.9.0 "
33+ assert Mix.Task . rerun ( "nodelix" , [ "--version" ] ) == :ok
34+ end ) =~ "18.18.2 "
3535
36- Application . delete_env ( :nodelix , :version )
37-
38- Mix.Task . rerun ( "nodelix.install" , [ "--if-missing" ] )
36+ Application . put_env ( :nodelix , :version , @ version )
3937
4038 assert ExUnit.CaptureIO . capture_io ( fn ->
41- assert Mix.Task . run ( "nodelix" , [ "--version" ] ) == :ok
39+ assert Mix.Task . rerun ( "nodelix" , [ "--version" ] ) == :ok
4240 end ) =~ @ version
4341 end
4442
43+ test "re-installs with force flag" do
44+ assert ExUnit.CaptureLog . capture_log ( fn ->
45+ assert Mix.Task . rerun ( "nodelix.install" , [ "--force" ] ) == :ok
46+ end ) =~ "Succesfully installed Node.js v#{ @ version } "
47+ end
48+
4549 test "installs with custom URL" do
4650 assert :ok =
4751 Mix.Task . rerun ( "nodelix.install" , [
0 commit comments