Sha256: efe95785782b43e2d66bf8581302850be6aee998111518856cc7fc3a1bdc944f
Contents?: true
Size: 1.14 KB
Versions: 5
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true require "spec_helper" module Doorkeeper::OAuth describe CodeRequest do let(:pre_auth) do double( :pre_auth, client: double(:application, id: 9990), redirect_uri: "http://tst.com/cb", scopes: nil, state: nil, error: nil, authorizable?: true, code_challenge: nil, code_challenge_method: nil ) end let(:owner) { double :owner, id: 8900 } subject do CodeRequest.new(pre_auth, owner) end it "creates an access grant" do expect do subject.authorize end.to change { Doorkeeper::AccessGrant.count }.by(1) end it "returns a code response" do expect(subject.authorize).to be_a(CodeResponse) end it "does not create grant when not authorizable" do allow(pre_auth).to receive(:authorizable?).and_return(false) expect { subject.authorize }.not_to(change { Doorkeeper::AccessGrant.count }) end it "returns a error response" do allow(pre_auth).to receive(:authorizable?).and_return(false) expect(subject.authorize).to be_a(ErrorResponse) end end end
Version data entries
5 entries across 5 versions & 1 rubygems