Passing data to session while testing in Elixir
| 1 min read
I struggled a while when I tried to pass data to the session while setting up a Liveview test. I googled a lot and asked on the elixir slack for a solution, but everything I saw seemed quite complicated, and I didn't manage to make it work.
I probably messed up something.
I finally found relief and a blog post with a one liner that does it :
Plug.Test.init_test_session(conn, user_id: 1)
The Plug documentation doesn't say much more.
Whenever you're ready, here is how I can help you:
- Improve your automated testing : You will learn how to fix your tests and make them pass from things that slow you down to things that save you time. This is a self-paced video course in French.
- Helping your teams: I help software teams deliver better software sooner. We'll work on technical issues with code, test or architecture, or the process and organization depending on your needs. Book a free call where we'll discuss how things are going on your side and how I can help you.
- Deliver a talk in your organization: I have a few talks that I enjoy presenting, and I can share with your organization(meetup, conference, company, BBL). If you feel that we could work on a new topic together, let's discuss that.