Sha256: f82ab8a6415ac221fe9f4a54c58a1da33224f6e84921bb3d28214543bed1b4c7
Contents?: true
Size: 1.11 KB
Versions: 8
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true RSpec.describe FinAppsCore::Middleware::NoEncodingBasicAuthentication do let(:key) { FinAppsCore::Middleware::NoEncodingBasicAuthentication::KEY } describe '#call' do app = proc {|env| env } context 'when credentials were provided' do let(:middleware) { FinAppsCore::Middleware::NoEncodingBasicAuthentication.new(app, :token) } let(:expected_header_value) { "Bearer #{:token}" } context 'when header was not previously set' do let(:request_env) { {request_headers: {}} } subject(:result) { middleware.call(request_env) } it('generates a header') { expect(result[:request_headers][key]).to eq(expected_header_value) } end context 'when header was previously set' do let(:request_env) { {request_headers: {key => 'foo'}} } subject(:result) { middleware.call(request_env) } it('does not override existing header') { expect(result[:request_headers][key]).to eq('foo') } it('does not generate a header') { expect(result[:request_headers][key]).to_not eq(expected_header_value) } end end end end
Version data entries
8 entries across 8 versions & 1 rubygems