1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Add adapter for old syntax, fixes #3139

This commit is contained in:
Mike Perham 2016-09-15 07:19:46 -07:00
parent d8f11c2651
commit 4a0d1e82b1
2 changed files with 10 additions and 0 deletions

View file

@ -63,6 +63,11 @@ module Sidekiq
@views ||= VIEWS @views ||= VIEWS
end end
# Helper for the Sinatra syntax: Sidekiq::Web.set(:session_secret, Rails.application.secrets...)
def set(attribute, value)
send(:"#{attribute}=", value)
end
attr_accessor :app_url, :session_secret, :redis_pool attr_accessor :app_url, :session_secret, :redis_pool
attr_writer :locales, :views attr_writer :locales, :views
end end

View file

@ -28,6 +28,11 @@ class TestWeb < Sidekiq::Test
end end
end end
it 'can configure via set() syntax' do
app.set(:session_secret, "foo")
assert_equal "foo", app.session_secret
end
it 'can show text with any locales' do it 'can show text with any locales' do
rackenv = {'HTTP_ACCEPT_LANGUAGE' => 'ru,en'} rackenv = {'HTTP_ACCEPT_LANGUAGE' => 'ru,en'}
get '/', {}, rackenv get '/', {}, rackenv