Sha256: ae606f075c21bd2e47c25f1d9e67a1750035d2d2108c1aa9fc25d222817045ba
Contents?: true
Size: 1.75 KB
Versions: 94
Compression:
Stored size: 1.75 KB
Contents
require 'helper' describe Bearcat::Client::GroupCategories do before do @client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token") end it "returns group categories" do stub_get(@client, "/api/v1/courses/1809/group_categories").to_return(json_response("group_categories.json")) categories = @client.list_group_categories('courses', 1809) categories.count.should == 2 categories.first['name'].should == 'mark red' categories.last['name'].should == 'test group' end it 'returns a single group category' do stub_get(@client, "/api/v1/group_categories/2").to_return(json_response("group_category.json")) category = @client.group_category(2) category['name'].should == 'mark red' category['id'].should == 5 end it 'creates a new group category' do name = "new group category" stub_post(@client, "/api/v1/courses/1/group_categories").with(body: {"name" => name}).to_return(json_response("created_group_category.json")) group_category = @client.create_group_category('courses', 1, { name: name }) group_category["name"].should == name group_category["id"].should == 1 end it 'edits an existing group category' do name = "edited group category" stub_put(@client, "/api/v1/group_categories/1").with(body: {"name" => name}).to_return(json_response("edited_group_category.json")) group_category = @client.edit_group_category(1, { name: name }) group_category["name"].should == name group_category["id"].should == 1 end it 'deletes a group category' do stub_delete(@client, "/api/v1/group_categories/1").to_return(json_response('delete_group_category.json')) response = @client.delete_group_category(1) response["delete"].should == true end end
Version data entries
94 entries across 94 versions & 1 rubygems