Skip to content

Commit

Permalink
test mix coveralls.safe_travis error condition
Browse files Browse the repository at this point in the history
  • Loading branch information
msimonborg committed Mar 10, 2019
1 parent 191b5d6 commit 8df3f7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/mix/tasks/build.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if Mix.env() == :test do
@spec run_formatter([binary()]) :: any()
def run_formatter(argv) do
if System.version() >= @required_elixir_version do
IO.puts("#{cyan()}#{bright()}Running formatter")
Mix.shell().info("#{cyan()}#{bright()}Running formatter")
Format.run(["--check-equivalent" | argv])
else
raise RuntimeError, """
Expand Down
16 changes: 12 additions & 4 deletions test/mix/tasks_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,18 @@ defmodule ExUnit.Mix.Tasks.Receiver.BuildTest do
end
end

test "runs coveralls.safe_travis" do
with_mock Travis, run: fn _ -> nil end do
SafeTravis.run(["hello"])
assert_called(Travis.run(["hello"]))
describe "mix coveralls.safe_travis" do
test "runs" do
with_mock Travis, run: fn _ -> nil end do
SafeTravis.run(["hello"])
assert_called(Travis.run(["hello"]))
end
end

test "catches ExCoveralls.ReportUploadError" do
with_mock Travis, run: fn _ -> raise ExCoveralls.ReportUploadError end do
assert capture_io(:stderr, fn -> SafeTravis.run(["hello"]) end)
end
end
end
end

0 comments on commit 8df3f7a

Please sign in to comment.