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
request object and
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.