Last active
October 4, 2022 23:20
-
-
Save amattn/759553b6670015fab5bfe222d2749b3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_html_for_route(route_path) do | |
conn = Phoenix.ConnTest.build_conn() | |
conn = get(conn, route_path) | |
resp = html_response(conn, 200) | |
priv_static_path = | |
Path.join([ | |
:code.priv_dir(:dash_home), | |
"static", | |
route_path | |
]) | |
assert File.mkdir_p(priv_static_path) == :ok | |
priv_static_filepath = Path.join([priv_static_path, "index.html"]) | |
{:ok, file} = File.open(priv_static_filepath, [:write]) | |
assert IO.binwrite(file, resp) == :ok | |
File.close(file) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment