Sha256: 040278f01c1a66d91de009d3bd6926d486f89e7aa3b01d7f57fec6853d1842d6

Contents?: true

Size: 641 Bytes

Versions: 38

Compression:

Stored size: 641 Bytes

Contents

require 'spec_helper'

describe CoalescingPanda::Oauth2Controller 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

38 entries across 38 versions & 1 rubygems

Version Path
coalescing_panda-1.1.21.1 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.21 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.20 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.19 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-2.0.0 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.18 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.17 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.16 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.15 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.14 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.13 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.12 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.11 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.10 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.8 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.7 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.6 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.5 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.3 spec/controllers/coalescing_panda/oauth2_controller_spec.rb
coalescing_panda-1.1.0 spec/controllers/coalescing_panda/oauth2_controller_spec.rb