Sha256: 817bf326fbcd56c0b19dd826aec9948d438081e7b3003c5e7f8b395f5f0cb9e1
Contents?: true
Size: 1.33 KB
Versions: 8
Compression:
Stored size: 1.33 KB
Contents
require 'helper' describe Bearcat::Client::Accounts do before do @client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token") end it 'returns a list of all the accounts the user belongs to' do stub_get(@client, "/api/v1/accounts").to_return(json_response("accounts.json")) accounts = @client.list_accounts accounts.count.should == 1 accounts.first['name'].should == 'Local Testing' end it 'returns a list of all of the accounts admins' do stub_get(@client, "/api/v1/accounts/1/admins").to_return(json_response("account_admins.json")) account_admins = @client.account_admins(1) account_admins.count.should == 4 account_admins.first['id'].should == 3 account_admins.last['role'].should == 'Custom Admin' end it "returns a single account" do stub_get(@client, "/api/v1/accounts/1").to_return(json_response("single_account.json")) account = @client.account(1) account["id"].should == 1 account["name"].should == "Local Testing" end it "returns enrollment terms for an account" do stub_get(@client, "/api/v1/accounts/1/terms").to_return(json_response("enrollment_terms.json")) account = @client.terms(1) terms = account.members terms.count.should == 1 terms.first['id'].should == 4 terms.first['name'].should == 'Term 1' end end
Version data entries
8 entries across 8 versions & 1 rubygems