igniter/test/igniter_test.exs

39 lines
921 B
Elixir
Raw Permalink Normal View History

2024-05-28 15:30:41 +12:00
defmodule IgniterTest do
use ExUnit.Case
doctest Igniter
2024-08-21 06:32:02 +12:00
import Igniter.Test
2024-08-21 06:32:02 +12:00
describe "Igniter.copy_template/4" do
test "it evaluates and writes the template" do
test_project()
|> Igniter.copy_template("test/templates/template.css.eex", "lib/foobar.css",
class: "hello"
)
|> assert_creates("lib/foobar.css", """
.hello {
background: black
}
""")
end
2024-08-21 06:32:02 +12:00
test "it overwrites an existing file" do
test_project()
|> Igniter.copy_template("test/templates/template.css.eex", "lib/foobar.css",
class: "hello"
)
|> apply_igniter!()
|> Igniter.copy_template(
"test/templates/template.css.eex",
"lib/foobar.css",
[class: "goodbye"],
on_exists: :overwrite
)
|> assert_has_patch("lib/foobar.css", """
1 - |.hello {
1 + |.goodbye {
""")
2024-08-21 06:32:02 +12:00
end
end
2024-05-28 15:30:41 +12:00
end