Sha256: a1d55c6cda374cfe2ed6fcb6b6c334bd01231d3779c6da9273f3d7bae86bf11b

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 Bytes

Contents

require 'spec_helper'

RSpec.describe RDStation::AuthorizationHeader do
  
  describe ".initialize" do
    context "when access_token is nil" do
      it "raises an error" do
        expect do
          described_class.new(access_token: nil)
        end.to raise_error(ArgumentError)
      end
    end
  end
  
  describe "#to_h" do
    let(:access_token) { 'access_token' }
    
    it "generates the correct header" do
      header = described_class.new(access_token: access_token).to_h
      expect(header['Authorization']).to eq "Bearer #{access_token}"
      expect(header['Content-Type']).to eq "application/json"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.1.0 spec/lib/rdstation/authorization_header_spec.rb
rdstation-ruby-client-2.0.0 spec/lib/rdstation/authorization_header_spec.rb