I wrote a functional test that changes some environment variables of the request object to simulate the user logged in.
require 'test_helper' class BeesControllerTest < ActionController::TestCase
Functional test is working fine.
Now I want to do something similar, as part of integration testing. Here is what I tried:
require 'test_helper' class CreateBeeTest < ActionController::IntegrationTest fixtures :bees def test_create @request.env['HTTPS'] = "on" @request.env['SERVER_NAME'] = "sandbox.example.com" @request.env['REMOTE_USER'] = "joeuser"
I get a message that @request is zero. I suspect this has something to do with the session object, but I'm not sure how to make it work.
ruby-on-rails environment-variables integration-testing
rlandster
source share