Sha256: fcf39be960471bc60c3eb5f5d0d174708d23b76da8fcbe3d17d67072f0691f83

Contents?: true

Size: 663 Bytes

Versions: 21

Compression:

Stored size: 663 Bytes

Contents

require 'spec_helper'

describe CoalescingPanda::Oauth2Controller, :type => :controller do
  routes { CoalescingPanda::Engine.routes }

  describe "#redirect" do
    it 'creates a token in the db' do
      ENV['OAUTH_PROTOCOL'] = 'http'
      Bearcat::Client.any_instance.stub(retrieve_token: 'foobar')
      get :redirect, {user_id: 1, api_domain:'foo.com', code:'bar'}
      auth = CoalescingPanda::CanvasApiAuth.find_by_user_id_and_api_domain(1, 'foo.com')
      auth.should_not == nil
    end

    it "doesn't create a token in the db" do
      get :redirect, {error: 'your face'}
      CoalescingPanda::CanvasApiAuth.all.count.should == 0
    end

  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
coalescing_panda-3.2.3 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.2.2 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.2.1 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.2.0 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.14 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.13 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.12 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.11 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.10 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.9 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.8 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.7 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.6 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.5 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.4 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.3 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.2 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.1 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.1.0 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-3.0.1 spec/controllers/coalescing_panda/oauth2_controller_spec.rb