-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from brainnco/fix/output_file_error
Fix output file error
- Loading branch information
Showing
8 changed files
with
96 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ mix.exs | |
```elixir | ||
def deps do | ||
[ | ||
{:xcribe, "~> 0.7.9"} | ||
{:xcribe, "~> 0.7.10"} | ||
] | ||
end | ||
``` | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
defmodule Xcribe.WritterTest do | ||
use ExUnit.Case, async: false | ||
|
||
import ExUnit.CaptureIO | ||
|
||
alias Xcribe.Writter | ||
|
||
setup do | ||
on_exit(fn -> | ||
Application.delete_env(:xcribe, :output) | ||
end) | ||
|
||
:ok | ||
end | ||
|
||
describe "write/1" do | ||
test "writes given text to set output directory" do | ||
output_path = "/tmp/xcribe_#{:rand.uniform()}" | ||
Application.put_env(:xcribe, :output, output_path) | ||
|
||
assert capture_io(fn -> | ||
assert :ok == Writter.write("sample test") | ||
end) =~ "Xcribe documentation written in #{output_path}" | ||
|
||
assert File.read!(output_path) == "sample test" | ||
end | ||
|
||
test "raises InvalidOutputDestination if output directory cannot be accessed" do | ||
invalid_output_path = "/root/null" | ||
Application.put_env(:xcribe, :output, invalid_output_path) | ||
|
||
assert capture_io(fn -> | ||
assert :error == Writter.write("sample test") | ||
end) =~ "Output file errors" | ||
end | ||
end | ||
end |