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

Version Path
bearcat-1.3.44 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.43 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.41 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.40 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.39 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.38 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.37 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.36 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.35 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.34 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.33 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.32 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.30 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.28 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.27 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.26 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.25 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.24 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.23 spec/bearcat/client/group_categories_spec.rb
bearcat-1.3.22 spec/bearcat/client/group_categories_spec.rb