Skip to content

Commit

Permalink
Add missing name switch
Browse files Browse the repository at this point in the history
also fixed committer switch
  • Loading branch information
arfl committed Apr 14, 2019
1 parent c936063 commit f7851f1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mix/tasks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ defmodule Mix.Tasks.Coveralls do
aliases = [f: :filter, u: :umbrella, v: :verbose]
{remaining, options} = Mix.Tasks.Coveralls.parse_common_options(
args,
switches: switches ++ [sha: :string, token: :string, commiter: :string, branch: :string, message: :string],
switches: switches ++ [sha: :string, token: :string, committer: :string, branch: :string, message: :string, name: :string],
aliases: aliases ++ [n: :name, b: :branch, c: :committer, m: :message, s: :sha, t: :token]
)

Expand Down
28 changes: 28 additions & 0 deletions test/mix/tasks_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,34 @@ defmodule Mix.Tasks.CoverallsTest do
end
end

test_with_mock "post with default switches",
ExCoveralls.Poster, [execute: fn(_, _) -> :ok end] do
non_standard_args = ["--non_standard"]

post_args = [
"--token", "a_token",
"--sha", "asdf",
"--name", "a_name",
"--committer", "My Name",
"--branch", "my_branch",
"--message", "commit message",
"--umbrella"
] ++ non_standard_args

Mix.Tasks.Coveralls.Post.run(post_args)

excoveralls_config = ExCoveralls.ConfServer.get()

assert(excoveralls_config[:token] == "a_token")
assert(excoveralls_config[:sha] == "asdf")
assert(excoveralls_config[:service_name] == "a_name")
assert(excoveralls_config[:committer] == "My Name")
assert(excoveralls_config[:branch] == "my_branch")
assert(excoveralls_config[:message] == "commit message")
assert(excoveralls_config[:umbrella])
assert(excoveralls_config[:args] == ["--non_standard"])
end

test "extract service name by param" do
assert Mix.Tasks.Coveralls.Post.extract_service_name([name: "local_param"]) == "local_param"
end
Expand Down

0 comments on commit f7851f1

Please sign in to comment.