Sha256: b9f87f17a0243cf7e33561f671603e3d3c55e0f4b7a1443644a3d984f7f12c63

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Devise::Oauth2Providable::AuthorizationsController do
  describe 'GET #new' do
    context 'with valid redirect_uri' do
      let(:user) { create(:user) }
      let(:client) { create(:client) }
      let(:redirect_uri) { client.redirect_uri }
      before do
        sign_in user
        get :new, :client_id => client.identifier, :redirect_uri => redirect_uri, :response_type => 'code', :use_route => 'devise_oauth2_providable'
      end
      it { should respond_with :ok }
      it { should respond_with_content_type :html }
      it { should assign_to(:redirect_uri).with(redirect_uri) }
      it { should assign_to(:response_type) }
      it { should render_template 'devise/oauth2_providable/authorizations/new' }
      # it { should render_with_layout 'application' }
    end
    context 'with invalid redirect_uri' do
      let(:user) { create(:user) }
      let(:client) { create(:client) }
      let(:redirect_uri) { 'http://example.com/foo/bar' }
      before do
        sign_in user
        get :new, :client_id => client.identifier, :redirect_uri => redirect_uri, :response_type => 'code', :use_route => 'devise_oauth2_providable'
      end
      it { should respond_with :bad_request }
      it { should respond_with_content_type :html }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
anjlab-devise-oauth2-providable-1.1.3 spec/controllers/authorizations_controller_spec.rb
anjlab-devise-oauth2-providable-1.1.2 spec/controllers/authorizations_controller_spec.rb
anjlab-devise-oauth2-providable-1.1.1 spec/controllers/authorizations_controller_spec.rb
anjlab-devise-oauth2-providable-1.1.0 spec/controllers/authorizations_controller_spec.rb