Sha256: c6931a9fa497ab322575d6305bbde17c0376847dc9aef99d0b4b03598bcaf5a3
Contents?: true
Size: 1.05 KB
Versions: 44
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper.rb' describe Rack::OAuth2::Server::Token::SAML2Bearer do let(:request) { Rack::MockRequest.new app } let(:app) do Rack::OAuth2::Server::Token.new do |request, response| response.access_token = Rack::OAuth2::AccessToken::Bearer.new(access_token: 'access_token') end end let(:params) do { grant_type: 'urn:ietf:params:oauth:grant-type:saml2-bearer', client_id: 'client_id', assertion: '<xml>...</xml>' } end subject { request.post('/', params: params) } its(:status) { should == 200 } its(:content_type) { should == 'application/json' } its(:body) { should include '"access_token":"access_token"' } its(:body) { should include '"token_type":"bearer"' } context 'when assertion is missing' do before do params.delete_if do |key, value| key == :assertion end end its(:status) { should == 400 } its(:content_type) { should == 'application/json' } its(:body) { should include '"error":"invalid_request"' } end end
Version data entries
44 entries across 44 versions & 1 rubygems