       params = generate_payload(context.file_type, context.storage)
       file_path = generate_path()
       storage_id = context.storage.storage_id
-      {:ok, file} = FileController.create(params)
-      {:ok, file} = FileController.move(file, file_path, storage_id)
-
-      assert {:ok, ^file} = FileController.find(file.file_id)
-      assert file_path == file.file_path
+      {:ok, file1} = FileController.create(params)
+      {:ok, file1} = FileController.move(file1, file_path, storage_id)
+      {:ok, file2} = FileController.find(file1.file_id)
+
+      # moved to the correct file_path
+      assert file_path == file1.file_path
+
+      # found file is identical to the one yielded by move
+      assert file1 == file2
     end
 
     test "moves to to another storage", context do
       params = generate_payload(context.file_type, context.storage)
       {:ok, s} = StorageController.create()
-      {:ok, file} = FileController.create(params)
-      {:ok, file} = FileController.move(file, file.file_path, s.storage_id)
-
-      assert {:ok, ^file} = FileController.find(file.file_id)
-      assert s.storage_id == file.storage_id
-    end
-
-    test "fails when file exists", context do
+      {:ok, file1} = FileController.create(params)
+      {:ok, file1} = FileController.move(file1, file1.file_path, s.storage_id)
+      {:ok, file2} = FileController.find(file1.file_id)
+
+      # moved to the correct storage_id
+      assert s.storage_id == file1.storage_id
+
+      # found file is identical to the one yielded by move
+      assert file1 == file2
+    end
+
+    test "move fails on path identity conflict", context do
       params1 = generate_payload(context.file_type, context.storage)
       params2 =
         context.file_type

  describe "file fetching" do
    test "fetches an existent file", context do
      params = generate_payload(context.file_type, context.storage)
      {:ok, file} = FileController.create(params)
      assert {:ok, ^file} = FileController.find(file.file_id)
    end

    test "fails when files is not found" do
      assert {:error, :notfound} == FileController.find(PK.generate([]))
    end
  end

    test "updates the name", context do
      params1 = generate_payload(context.file_type, context.storage)
      params2 = generate_payload(context.file_type, context.storage)
      {:ok, file1} = FileController.create(params1)
      {:ok, file1} = FileController.update(file1, params2)
      {:ok, file2} = FileController.find(file1.file_id)

      # file updates to the correct name
      assert params2.name == file1.name

      # file is identical to the one yielded by update
      assert file1 == file2
    end

    test "updates the path", context do
      params1 = generate_payload(context.file_type, context.storage)
      params2 = generate_payload(context.file_type, context.storage)
      {:ok, file1} = FileController.create(params1)
      {:ok, file1} = FileController.update(file1, params2)
      {:ok, file2} = FileController.find(file1.file_id)

      # file updates to the correct file_path
      assert params2.file_path == file1.file_path

      # file is identical to the one yielded by update
      assert file1 == file2
    end

    test "updates the storage", context do
      {:ok, storage} = StorageController.create()
      params1 = generate_payload(context.file_type, context.storage)
      params2 = generate_payload(context.file_type, storage)
      {:ok, file1} = FileController.create(params1)
      {:ok, file1} = FileController.update(file1, params2)
      {:ok, file2} = FileController.find(file1.file_id)

      # file updates to the correct storage_id
      assert storage.storage_id == file1.storage_id

      # file is identical to the one yielded by update
      assert file1 == file2
    end

    test "update fails on path identity conflict", context do
      params1 = generate_payload(context.file_type, context.storage)
      params2 = generate_payload(context.file_type, context.storage)
      {:ok, _} = FileController.create(params1)
      {:ok, file1} = FileController.create(params2)

      # got expected error
      assert {:error, :file_exists} == FileController.update(file1, params1)

      {:ok, file2} = FileController.find(file1.file_id)

      # file is unchanged
      assert file1 == file2
    end
  end

