Sha256: 9b0f775e675631bf852d8bf19b4b04470f1f30ded4c64ca881b8805f37c0e20d

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe Restfulness::Requests::AuthorizationHeader do

  describe "#initialize" do

    let :klass do
      Restfulness::Requests::AuthorizationHeader
    end

    it "should accept standard header" do
      obj = klass.new("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
      expect(obj.schema).to eql("Basic")
      expect(obj.params).to eql("QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
    end

    it "should accept non-standard schema" do
      obj = klass.new("bAsic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
      expect(obj.schema).to eql("Basic")
      expect(obj.params).to eql("QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
    end

    it "should ignore any whitespace" do
      obj = klass.new(" Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== ")
      expect(obj.schema).to eql("Basic")
      expect(obj.params).to eql("QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
    end

    it "should append additional stuff" do
      obj = klass.new("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== foooo")
      expect(obj.schema).to eql("Basic")
      expect(obj.params).to eql("QWxhZGRpbjpvcGVuIHNlc2FtZQ== foooo")
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
restfulness-0.3.6 spec/unit/requests/authorization_header_spec.rb
restfulness-0.3.5 spec/unit/requests/authorization_header_spec.rb
restfulness-0.3.4 spec/unit/requests/authorization_header_spec.rb
restfulness-0.3.3 spec/unit/requests/authorization_header_spec.rb