Sha256: 630514ec2d551f5961cff65f932251518493d694a2effc0ed0308509b66d1c36

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 Bytes

Contents

require 'spec_helper'

describe Restfulness::Requests::Authorization do

  let :app do
    Class.new(Restfulness::Application) do
      routes do
        # empty
      end
    end
  end
  let :request do
    Restfulness::Request.new(app)
  end

  describe "#authorization" do

    it "should be nil if no authorization header resent" do
      auth = request.authorization
      auth.should be_nil
    end
 
    it "should build new authorization header when present" do
      request.headers[:authorization] = "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
      auth = request.authorization
      auth.should be_a(Restfulness::Requests::AuthorizationHeader)
      auth.schema.should eql("Basic")
    end

 end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restfulness-0.3.2 spec/unit/requests/authorization_spec.rb
restfulness-0.3.1 spec/unit/requests/authorization_spec.rb