Sha256: dcd64af5fc02085e4fba1416111edb6a304ff713c0a70553a8fe03f9a10fd964
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
# encoding: utf-8 # frozen_string_literal: true require_relative 'helper' require 'sidekiq/web' require 'rack/test' class TestWebSessions < Sidekiq::Test describe 'sidekiq web sessions options' do include Rack::Test::Methods describe 'using #disable' do def app app = Sidekiq::Web.new app.disable(:sessions) app end it "doesn't create sessions" do get '/' assert_nil last_request.env['rack.session'] end end describe 'using #set with false argument' do def app app = Sidekiq::Web.new app.set(:sessions, false) app end it "doesn't create sessions" do get '/' assert_nil last_request.env['rack.session'] end end describe 'using #set with an hash' do def app app = Sidekiq::Web.new app.set(:sessions, { domain: :all }) app end it "creates sessions" do get '/' refute_nil last_request.env['rack.session'] refute_empty last_request.env['rack.session'].options assert_equal :all, last_request.env['rack.session'].options[:domain] end end describe 'using #enable' do def app app = Sidekiq::Web.new app.enable(:sessions) app end it "creates sessions" do get '/' refute_nil last_request.env['rack.session'] refute_empty last_request.env['rack.session'].options refute_nil last_request.env['rack.session'].options[:secret] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-5.0.0.beta1 | test/test_web_sessions.rb |