Sha256: c8c7e435fd38c2384791615b6b5805749abd46723413e87a896b5aa2ccb0dc0e

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require_relative '../../helper'

module GitDuplicator
  module Helpers
    describe AuthorizationHeader do
      let(:credentials) { { username: 'user', password: 'password' } }
      let(:request) { { method: :post, url: 'onetwo' } }
      let(:header) { described_class.new(credentials, request) }

      describe '#basic_authenticaion_header' do
        it 'should have the right value' do
          result = header.send :basic_authenticaion_header
          encode64 = Base64.encode64("#{credentials[:username]}" \
                                     ":#{credentials[:password]}")
          expect(result).to eq("Basic #{encode64}")
        end
      end

      describe '#basic_authenticaion_header' do
        it 'should have the right value' do
          result = header.send :base64_username_password
          encode64 = Base64.encode64("#{credentials[:username]}" \
                                     ":#{credentials[:password]}")
          expect(result).to eq(encode64)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_duplicator-1.0.0 spec/git_duplicator/helpers/authorization_header_spec.rb