Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing name switch, also fixed committer switch #180

Merged
merged 1 commit into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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