Sha256: 89e7229820f520e58e700c961ed9a36ab6ecc7c1902bfef4a3e56a21e651ffb9

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 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

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bearcat-1.2.17 spec/bearcat/client/group_categories_spec.rb
bearcat-1.2.16 spec/bearcat/client/group_categories_spec.rb
bearcat-1.2.15 spec/bearcat/client/group_categories_spec.rb
bearcat-1.2.14 spec/bearcat/client/group_categories_spec.rb
bearcat-1.2.13 spec/bearcat/client/group_categories_spec.rb
bearcat-1.2.12 spec/bearcat/client/group_categories_spec.rb
bearcat-1.2.11 spec/bearcat/client/group_categories_spec.rb
bearcat-1.2.10 spec/bearcat/client/group_categories_spec.rb