-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch changes the `PathReader.base_path` function to try reading from the `Application` first, using the current method as a fallback mechanism in case the config is not available. The reason for this change is that we want to instrument a running elixir app while executing some acceptance tests and `Mix.Project.config_files` does not have all the necessary information to infer the path.
- Loading branch information
Showing
3 changed files
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
defmodule ExCoveralls.PathReaderTest do | ||
use ExUnit.Case | ||
use ExUnit.Case, async: false | ||
alias ExCoveralls.PathReader | ||
|
||
test "gets project base path" do | ||
assert(PathReader.base_path == File.cwd!) | ||
assert(PathReader.base_path() == File.cwd!()) | ||
end | ||
|
||
test "expand path" do | ||
assert(PathReader.expand_path("test") == File.cwd! <> "/test") | ||
assert(PathReader.expand_path("test") == File.cwd!() <> "/test") | ||
end | ||
|
||
test "use the application config when it is available" do | ||
Application.put_env(:excoveralls, :base_path, "/base/path") | ||
assert("/base/path" != File.cwd!()) | ||
assert(PathReader.base_path() == "/base/path") | ||
after | ||
Application.delete_env(:excoveralls, :base_path) | ||
end | ||
end |