defmodule JOL.Blog.PostTest do use ExUnit.Case, async: true alias JOL.Blog.Post setup do attrs = %{ title: "Test Post", tags: ["testing", "post"], date: ~D[1999-09-09], slug: "test-post" } {:ok, attrs: attrs} end test "extracts ledes from delimiters", %{attrs: attrs} do body = """ lede goes here not this though. """ post = Post.build("filename", attrs, body) assert post.lede == "lede goes here" end test "extract ledes without delimiters", %{attrs: attrs} do body = Enum.map_join(1..100, &("Word#{&1} ")) post = Post.build("filename", attrs, body) assert String.split(post.lede) |> Enum.count == 50 end end