Is session supposed to be exposed in request specs?

I'm relatively new to rspec and for some reason I had it in my head that I wasn't able to access the session in a Request spec. I've been building out a test suite for an app and recently hit a situation where I wanted to ask the controller a question about the current user while in a request spec. I dropped a binding.pry inside my request spec and executed the following when the breakpoint fired:


I expected that to fail due to the request spec not knowing about the controller, but it worked! I can access the current controller, request object and session.

Is having access to controller, request and session in a Request spec standard behavior in rspec, or do I have a configuration problem somewhere that is exposing this info?

I'm using rspec 3.5.1 (but I get the same results in 3.4.2). The only other testing related gems that I am using are capybara, factory_girl_rails, database_cleaner and selenium-webdriver.


Category: rspec Time: 2016-07-28 Views: 0
Tags: rspec

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.217 (s). 12 q(s)