   describe "expand/1" do
     test "does not do anything with templates without include/2 call" do
       ast = EEx.compile_string("Hello, <%= :world %>!")
-      {:ok, new_ast} = Include.expand(ast)
+      template = make_template(ast)
+      :ok = Include.expand(template)
 
-      assert ast === new_ast
+      assert ast === "test" |> TS.get(:template) |> Map.get(:ast)
     end
 
     test "expands simple include/2 macros" do
-      ast = EEx.compile_string("[<%= include(\"simple\") %>]")
-      {:ok, new_ast} = Include.expand(ast)
-      {rendered, _} = Code.eval_quoted(new_ast)
+      template = make_template(EEx.compile_string("[<%= include(\"simple\") %>]"))
+      :ok = Include.expand(template)
+
+      {rendered, _} =
+        "test"
+        |> TS.get(:template)
+        |> Map.get(:ast)
+        |> Code.eval_quoted()
 
       assert rendered === "[Hello, world!]"
     end
 
     test "expands nested include/2 macros" do
-      ast = quote(do: include("nested_1"))
-      {:ok, new_ast} = Include.expand(ast)
-      {rendered, _} = Code.eval_quoted(new_ast)
+      template = make_template(quote(do: include("nested_1")))
+      :ok = Include.expand(template)
+
+      {rendered, _} =
+        "test"
+        |> TS.get(:template)
+        |> Map.get(:ast)
+        |> Code.eval_quoted()
 
       assert rendered === "Nested1 Nested2"
     end
 
     test "fails with non-existent includes" do
-      ast = quote(do: include("foobarbaz"))
-      {:ct_error, msg, _} = Include.expand(ast)
+      template = make_template(quote(do: include("foobarbaz")))
+      result = Include.expand(template)
 
-      assert String.contains?(msg, "foobarbaz")
+      assert Result.get_message(result, 0) =~ "foobarbaz"
     end
 
     test "fails when nested includes have cycles - simple" do
-      ast = quote(do: include("simple_cycle"))
-      {:ct_error, msg, _} = Include.expand(ast)
+      template = make_template(quote(do: include("simple_cycle")))
+      result = Include.expand(template)
 
-      assert msg =~ "simple_cycle"
+      assert Result.get_message(result, 0) =~ "simple_cycle"
     end
 
     test "fails when nested includes have cycles - deep" do
-      ast = quote(do: include("deep_cycle_1"))
-      {:ct_error, msg, _} = Include.expand(ast)
+      template = make_template(quote(do: include("deep_cycle_1")))
+      result_message = template |> Include.expand() |> Result.get_message(0)
 
       1..3
       |> Enum.map(&"deep_cycle_#{&1}")
-      |> Enum.each(fn name -> assert msg =~ name end)
+      |> Enum.each(fn name -> assert result_message =~ name end)
     end
   end
 

      {"deep_cycle_2", quote(do: include("deep_cycle_3"))},
      {"deep_cycle_3", quote(do: include("deep_cycle_1"))}
    ]
    |> Enum.map(fn {name, ast} -> {name, %{name: name, ast: ast}} end)
    |> Enum.into(%{})

  defp includes, do: unquote(Macro.escape(include_sources))
end

defmodule Serum.Template.Compiler.IncludeTest do
  use ExUnit.Case
  alias Serum.Result
  alias Serum.Template
  alias Serum.Template.Compiler.Include
  alias Serum.Template.Storage, as: TS

