From 120bb8e5fb66b395c0b429ab7fe4ec7a04f7eba3 Mon Sep 17 00:00:00 2001 From: Jessica Phoenix Canady Date: Tue, 21 May 2024 12:46:48 -0400 Subject: [PATCH] Refactor test to use setup() --- test/lib/blog/parser_test.exs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/lib/blog/parser_test.exs b/test/lib/blog/parser_test.exs index e6887e7..cc4524a 100644 --- a/test/lib/blog/parser_test.exs +++ b/test/lib/blog/parser_test.exs @@ -2,7 +2,7 @@ defmodule Jol.Blog.ParserTest do use ExUnit.Case, async: true alias Jol.Blog.Parser - test "parses attrs from zola-style posts" do + setup do content = """ +++ title = "test post" @@ -16,7 +16,11 @@ defmodule Jol.Blog.ParserTest do Body! """ - {_attrs, body} = Parser.parse("/fake/filename", content) + {:ok, content: content} + end + + test "parses attrs from zola-style posts", post do + {_attrs, body} = Parser.parse("/fake/filename", post.content) assert body == "Body!" end end