diff --git a/lib/file_system/backends/fs_inotify.ex b/lib/file_system/backends/fs_inotify.ex index 366040caa70f70afe8b3d610fb49cfe2e7af9dee..8fd556617a11c8174c60247f06f1f713f6a0e4c0 100644 --- a/lib/file_system/backends/fs_inotify.ex +++ b/lib/file_system/backends/fs_inotify.ex @@ -157,9 +157,9 @@ defmodule FileSystem.Backends.FSInotify do end defp convert_flag("CREATE"), do: :created - defp convert_flag("MOVED_TO"), do: :created + defp convert_flag("MOVED_TO"), do: :moved_to defp convert_flag("DELETE"), do: :deleted - defp convert_flag("MOVED_FROM"), do: :deleted + defp convert_flag("MOVED_FROM"), do: :moved_from defp convert_flag("ISDIR"), do: :isdir defp convert_flag("MODIFY"), do: :modified defp convert_flag("CLOSE_WRITE"), do: :modified diff --git a/test/backends/fs_inotify_test.exs b/test/backends/fs_inotify_test.exs index 414ed56ca7cac8c08cdcb04198cdbff27715d9b5..1482efff7f0a4c1e3754f298cefcd16d22f58022 100644 --- a/test/backends/fs_inotify_test.exs +++ b/test/backends/fs_inotify_test.exs @@ -42,10 +42,15 @@ defmodule FileSystem.Backends.FSInotifyTest do end test "dir moved to" do - assert {"/one/two/file", [:created]} == + assert {"/one/two/file", [:moved_to]} == ~w|/one/two/ MOVED_TO file| |> to_port_line |> parse_line end + test "dir moved from" do + assert {"/one/two/file", [:moved_from]} == + ~w|/one/two/ MOVED_FROM file| |> to_port_line |> parse_line + end + test "dir is_dir create" do assert {"/one/two/dir", [:created, :isdir]} == ~w|/one/two/ CREATE,ISDIR dir| |> to_port_line |> parse_line