1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00

Freeze omniauth in test to verify thread safety

This commit is contained in:
Bobby McDonald 2020-12-10 13:04:28 -05:00
parent d4c1ff0ffb
commit e405613685
No known key found for this signature in database
GPG key ID: CAD931A49619329A
3 changed files with 5 additions and 6 deletions

View file

@ -20,6 +20,7 @@ group :test do
gem 'rack-test'
gem 'rest-client', '~> 2.0.0', :platforms => [:jruby_18]
gem 'rspec', '~> 3.5'
gem 'rack-freeze'
gem 'rubocop', '>= 0.58.2', '< 0.69.0', :platforms => %i[ruby_20 ruby_21 ruby_22 ruby_23 ruby_24]
gem 'simplecov-lcov'
gem 'tins', '~> 1.13', :platforms => %i[jruby_18 jruby_19 ruby_19]

View file

@ -20,6 +20,7 @@ end
require 'rspec'
require 'rack/test'
require 'rack/freeze'
require 'omniauth'
require 'omniauth/test'

View file

@ -121,14 +121,11 @@ describe OmniAuth::Builder do
describe '#call' do
it 'passes env to to_app.call' do
app = lambda { |_env| [200, {}, []] }
app = lambda { |env| [200, {}, env['CUSTOM_ENV_VALUE']] }
builder = OmniAuth::Builder.new(app)
env = {'REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/some/path'}
allow(app).to receive(:call).and_call_original
env = {'REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/some/path', 'CUSTOM_ENV_VALUE' => 'VALUE'}
builder.call(env)
expect(app).to have_received(:call).with(env)
expect(builder.call(env)).to eq([200, {}, 'VALUE'])
end
end