Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing Phoenix Controller rendering #186

Open
ndrean opened this issue Oct 26, 2022 · 0 comments
Open

Testing Phoenix Controller rendering #186

ndrean opened this issue Oct 26, 2022 · 0 comments
Assignees
Labels
help wanted If you can help make progress with this issue, please comment! question A question needs to be answered before progress can be made on this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies

Comments

@ndrean
Copy link
Contributor

ndrean commented Oct 26, 2022

Hi there!

I have a basic controller "welcome" that does: render(conn, "index.html", profile: profile)
There are some assigns to render

I want to write a test that demonstrates that the rendering is correct

if I do:

conn = get(conn, "/welcome")
assert html_response(conn, 200) =~"hi"

Since some template assigns are present in the template, my test says that a key is not present.

Using Plug.Conn.assign(conn, :profile, %{k: v}) is ineffective.

Does anyone know how to do this? The doc is void on this or didn't find where.

@nelsonic nelsonic added help wanted If you can help make progress with this issue, please comment! question A question needs to be answered before progress can be made on this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted If you can help make progress with this issue, please comment! question A question needs to be answered before progress can be made on this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies
Projects
None yet
Development

No branches or pull requests

3 participants