Sha256: d3be60f5751d76b739af50224ee909e93510b83d12590f71e0fe67721e4a3a2c
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
shared_context "valid token", :token => :valid do let :token_string do "1A2B3C4D" end let :token do double(Doorkeeper::AccessToken, :accessible? => true) end before :each do allow(Doorkeeper::AccessToken).to receive(:authenticate).with(token_string).and_return(token) end end shared_context "invalid token", :token => :invalid do let :token_string do "1A2B3C4D" end let :token do double(Doorkeeper::AccessToken, :accessible? => false, :revoked? => false, :expired? => false) end before :each do allow(Doorkeeper::AccessToken).to receive(:authenticate).with(token_string).and_return(token) end end shared_context "authenticated resource owner" do before do user = double(:resource, :id => 1) allow(Doorkeeper.configuration).to receive(:authenticate_resource_owner) { proc do user end } end end shared_context "not authenticated resource owner" do before do allow(Doorkeeper.configuration).to receive(:authenticate_resource_owner) { proc do redirect_to '/' end } end end shared_context "valid authorization request" do let :authorization do double(:authorization, :valid? => true, :authorize => true, :success_redirect_uri => "http://something.com/cb?code=token") end before do allow(controller).to receive(:authorization) { authorization } end end shared_context "invalid authorization request" do let :authorization do double(:authorization, :valid? => false, :authorize => false, :redirect_on_error? => false) end before do allow(controller).to receive(:authorization) { authorization } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper-1.1.0 | spec/support/shared/controllers_shared_context.rb |
doorkeeper-1.0.0 | spec/support/shared/controllers_shared_context.rb |