Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

adding hash to session #3

Open
scottbarrow opened this issue Aug 15, 2020 · 1 comment
Open

adding hash to session #3

scottbarrow opened this issue Aug 15, 2020 · 1 comment

Comments

@scottbarrow
Copy link
Contributor

I see that session is stubbed and returns only a load! method, however how can I add to this to add say a {current_user_id: 1} hash

@jasoncharnes
Copy link
Contributor

jasoncharnes commented Aug 17, 2020

Are you using RSpec?

If so, you may be able to stub out the request from the Reflex.

session = double(:session, current_user_id: 1)
reflex = stub_reflex(...)
allow(reflex).to receive(:session) { session } 

If you go this route, you may need to implement the load! method, as well.

We'd be open to seeing some better session handling PRs as well! 🙂 We use a session store unsupported by StimulusReflex so we don't have much need to test it, currently.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants