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