Sha256: 4617870efe41fa06f8c18b2b108a258d1f5f313031e50ba9b636d8fb66a0375f

Contents?: true

Size: 768 Bytes

Versions: 2

Compression:

Stored size: 768 Bytes

Contents

require "spec_helper"

describe "Authentication" do
  include RestApiSpecHelper
  include AuthenticatedContext

  describe "GET /echo" do
    context "without valid token" do
      before do
        header["Authorization"] = "Bearer #{access_token.token}"
        access_token.destroy
      end

      it "returns 401 with JSON" do
        should == 401
        response.body.should be_json
      end
    end

    context "without any access token candidate" do
      before do
        header["Authorization"] = nil
      end

      it "returns 401 without access token verification" do
        should == 401
        response.body.should be_json
      end
    end

    context "with valid access token from auth server" do
      it { should == 200 }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
garage-doorkeeper-2.0.0 spec/requests/authentication_spec.rb
garage-doorkeeper-1.0.0 spec/requests/authentication_spec.rb