Sha256: 7415d814f4b0fe9113e799297a1903f728aefdfb61f7ed31bcd145eac95ad839
Contents?: true
Size: 1.11 KB
Versions: 15
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
15 entries across 15 versions & 1 rubygems