Sha256: 4e54b92c69f133b23dd2186bc34b5090b510285849ef8eaa2c92c6bf77926a34

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

require 'spec_helper_integration'

describe Doorkeeper::TokensController do
  describe "when authorization has succeeded" do
    let :token do
      double(:token, :authorize => true)
    end

    before do
      controller.stub(:token) { token }
    end

    it "returns the authorization" do
      token.should_receive(:authorization)
      post :create, :use_route => :doorkeeper
    end
  end

  describe "when authorization has failed" do
    let :token do
      double(:token, :authorize => false)
    end

    before do
      controller.stub(:token) { token }
    end

    it "returns the error response" do
      token.stub(:error_response => stub(:to_json => [], :status => :unauthorized))
      post :create, :use_route => :doorkeeper
      response.status.should == 401
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-0.4.2 spec/controllers/tokens_controller_spec.rb
doorkeeper-0.4.1 spec/controllers/tokens_controller_spec.rb
doorkeeper-0.4.0 spec/controllers/tokens_controller_spec.rb