Skip to content

Commit

Permalink
update test assert
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoch-cars committed Sep 21, 2021
1 parent afb8b51 commit cb5eff2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/ex_factor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ defmodule ExFactor do
|> Keyword.put_new(:source_path, path(source_module))

emplace = Extractor.emplace(opts)
remove = Remover.remove(opts)
changes = Changer.change(opts)
# remove should be last (before format)
remove = Remover.remove(opts)
{emplace, remove, changes}
|> IO.inspect(label: "refactor all changes")
end
Expand Down
2 changes: 0 additions & 2 deletions lib/ex_factor/extractor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ defmodule ExFactor.Extractor do
}
end

defp write_file(target_path, contents, _module, _dry_run) do
File.write(target_path, contents, [:write])
defp write_file(target_path, contents, module, _dry_run) do
_ = File.write(target_path, contents, [:write])
%{
Expand Down
4 changes: 1 addition & 3 deletions lib/ex_factor/remover.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ defmodule ExFactor.Remover do
@moduledoc """
Documentation for `ExFactor.Remover`.
"""
alias ExFactor.Util

alias ExFactor.Parser

@doc """
Expand Down Expand Up @@ -69,7 +67,7 @@ alias ExFactor.Util
File.write(path, contents, [:write])
end

defp path(module), do: Util.path(module)
defp path(module), do: ExFactor.path(module)

defp function_name(name) when is_binary(name) do
String.to_atom(name)
Expand Down
6 changes: 3 additions & 3 deletions test/ex_factor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule ExFactorTest do
arity: 1
]

results = ExFactor.refactor(opts)
{_, _, _} = _results = ExFactor.refactor(opts)

file = File.read!("lib/ex_factor/tmp/target_module.ex")
assert file =~ "def(refactor1(arg1)) do"
Expand All @@ -61,7 +61,7 @@ defmodule ExFactorTest do
# |> IO.inspect(label: "")
refute file =~ "def refactor1(arg1) do"
refute file =~ "def refactor1([]) do"
assert results == {:ok, :ok}
# assert results == {:ok, :ok}
end

test "it returns the results of the dry_run changes" do
Expand Down Expand Up @@ -106,7 +106,7 @@ defmodule ExFactorTest do
dry_run: true
]

{_extract_contents, _remove_contents} = ExFactor.refactor(opts)
{_extract_results, _remove_results, _change_results} = ExFactor.refactor(opts)

# assert that the original files are unchanged
file = File.read!("lib/ex_factor/tmp/target_module.ex")
Expand Down

0 comments on commit cb5eff2

Please sign in to comment.