You need to set your test to run as a controller test.
A controller test have already access to session hash, and you can use
wherever you want inside it
To set your tests to run as controller test you need just:
describe MyController, type: :controller do
before { session[:mysession] = value }
end
On Thu, Dec 4, 2014 at 5:03 AM, bertly_the_coder <[email protected]> wrote:
> Hi Guys,
>
> I'm writing some tests in Rspec and one of them needs a session to be set.
> Does anyone know how to set a session in Rails tests?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "rspec" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rspec/fc14d48d-4c44-48dc-97b9-a17442b25586%40googlegroups.com
> <https://groups.google.com/d/msgid/rspec/fc14d48d-4c44-48dc-97b9-a17442b25586%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/CANPOtXuJ%2BLBGhP__t_JWz-vX7y5o%3Dzt1x0a%3DoemqpqyFOtTFOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.