Sha256: 5bfd2c64a7cd2677c40f12ee167ea992404a5a852ef06756bc02a879979a3491
Contents?: true
Size: 876 Bytes
Versions: 4
Compression:
Stored size: 876 Bytes
Contents
require 'spec_helper' describe Clearance::RackSession do it 'injects a clearance session into the environment' do headers = { 'X-Roaring-Lobster' => 'Red' } app = Rack::Builder.new do use Clearance::RackSession run lambda { |env| Rack::Response.new(env[:clearance], 200, headers).finish } end env = Rack::MockRequest.env_for('/') expected_session = "the session" allow(expected_session).to receive(:add_cookie_to_headers) allow(expected_session).to receive(:authentication_successful?). and_return(true) allow(Clearance::Session).to receive(:new). with(env). and_return(expected_session) response = Rack::MockResponse.new(*app.call(env)) expect(response.body).to eq expected_session expect(expected_session).to have_received(:add_cookie_to_headers). with(hash_including(headers)) end end
Version data entries
4 entries across 4 versions & 1 rubygems