Sha256: 6c3fa194f8ed853ebde3e69dbdc6f8e614989a9e4694b8ab5b09b6cc79c89c31
Contents?: true
Size: 784 Bytes
Versions: 2
Compression:
Stored size: 784 Bytes
Contents
require 'spec_helper' describe Clearance::RackSession do it 'injects a clearance session into the environment' do expected_session = 'the session' expected_session.stubs :add_cookie_to_headers Clearance::Session.stubs new: expected_session 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('/') response = Rack::MockResponse.new(*app.call(env)) expect(Clearance::Session).to have_received(:new).with(env) expect(response.body).to eq expected_session expect(expected_session).to have_received(:add_cookie_to_headers). with(has_entries(headers)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
clearance-1.5.1 | spec/clearance/rack_session_spec.rb |
clearance-1.5.0 | spec/clearance/rack_session_spec.rb |