Sha256: 36c41c45ff6dea1a7ed460286abb18378c7146a00240cf348ba725b86ceb4473

Contents?: true

Size: 1.29 KB

Versions: 26

Compression:

Stored size: 1.29 KB

Contents

require 'helper'

describe Bearcat::Client::AssignmentGroups do
  before do
    @client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
  end

  it "returns all assignment groups for a course" do
    stub_get(@client, "/api/v1/courses/1/assignment_groups").to_return(json_response("assignment_groups.json"))
    assignment_groups = @client.list_assignment_groups(1)
    assignment_groups.count.should == 2
    assignment_groups.first["group_weight"].should == 500
    assignment_groups.first["id"].should == 2
    assignment_groups.first["name"].should == 'Quizzes'
  end

  it 'returns a single assignment_group' do
    stub_get(@client, '/api/v1/courses/2/assignment_groups/1').to_return(json_response("assignment_group.json"))
    assignment_group = @client.assignment_group(2, 1)
    assignment_group["group_weight"].should == 500
    assignment_group["id"].should == 2
    assignment_group["name"].should == 'Quizzes'
  end

  it 'creates an assignment_group' do
    params = {'name' => 'New Assignment Group'}
    stub_post(@client, "/api/v1/courses/2/assignment_groups").with(body: params).to_return(json_response("assignment_group.json"))
    new_assignment_group = @client.create_assignment_group(2, params)
    expect(new_assignment_group['name']).to eq('Quizzes')
  end

end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
bearcat-1.3.30 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.28 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.27 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.26 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.25 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.24 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.23 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.22 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.21 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.20 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.19 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.18 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.17 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.16 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.15 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.14 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.13 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.12 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.11 spec/bearcat/client/assignment_groups_spec.rb
bearcat-1.3.10 spec/bearcat/client/assignment_groups_spec.rb