Sha256: 5a1e2542ffbbf4b587eb1f314396ac2d3f9e4bcca7c4cbb3f5b3e37a2c342b50
Contents?: true
Size: 953 Bytes
Versions: 56
Compression:
Stored size: 953 Bytes
Contents
require 'helper' describe Bearcat::Client::Enrollments do let(:client){Bearcat::Client.new(prefix: "http://canvas.instructure.com")} it "generates a redirect url" do redirect_url = client.auth_redirect_url(10000000000002, 'http://localhost:9393') redirect_url.should == "http://canvas.instructure.com/login/oauth2/auth?client_id=10000000000002&redirect_uri=http%3A%2F%2Flocalhost%3A9393&response_type=code" end it "sets the auth_token" do stub_post(client, "/login/oauth2/token"). with(:body => {"client_id"=>"10000000000002", "client_secret"=>"secret", "code"=>"code", "redirect_url"=>"http://localhost:9393"}). to_return(:body => {'access_token' => 'foo_bar_token'}) client.retrieve_token(10000000000002, 'http://localhost:9393', 'secret', 'code') client.config.token.should == "foo_bar_token" client.instance_variable_get(:@connection).headers[:authorization].should == 'Bearer foo_bar_token' end end
Version data entries
56 entries across 56 versions & 1 rubygems