Sha256: 32721ac85e08646aebb48cfd79aab8413f188424c83d8d2561ffe698f9ea6066

Contents?: true

Size: 1.1 KB

Versions: 17

Compression:

Stored size: 1.1 KB

Contents

require 'helper'

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

  it "returns a section" do
    stub_get(@client, "/api/v1/courses/3").to_return(json_response("course.json"))
    course = @client.course(3)
    course['name'].should == 'Course 3'
    course['id'].should == 3
    course['start_at'].should == '2012-06-01T00:00:00-06:00'
  end

  it "creates a new course" do
    name = "new course"
    stub_post(@client, "/api/v1/accounts/1/courses").with(body: {"course" => {"name" => name}}).to_return(json_response("created_course.json"))
    course = @client.create_course(1, {"course[name]" => name})
    course['name'].should == name
    course['id'].should == 1
  end

  it "lists all of the students in a course" do
    stub_get(@client, "/api/v1/courses/1/users?enrollment_type=student").to_return(json_response("course_students.json"))
    students = @client.list_course_users(1, {"enrollment_type" => "student"})
    students['name'].should == 'test@student.com'
    students['id'].should == 2
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bearcat-0.9.17 spec/bearcat/client/courses_spec.rb
bearcat-0.9.16 spec/bearcat/client/courses_spec.rb
bearcat-0.9.15 spec/bearcat/client/courses_spec.rb
bearcat-0.9.14 spec/bearcat/client/courses_spec.rb
bearcat-0.9.13 spec/bearcat/client/courses_spec.rb
bearcat-0.9.12 spec/bearcat/client/courses_spec.rb
bearcat-0.9.10 spec/bearcat/client/courses_spec.rb
bearcat-0.9.9 spec/bearcat/client/courses_spec.rb
bearcat-0.9.8 spec/bearcat/client/courses_spec.rb
bearcat-0.9.7 spec/bearcat/client/courses_spec.rb
bearcat-0.9.6 spec/bearcat/client/courses_spec.rb
bearcat-0.9.5 spec/bearcat/client/courses_spec.rb
bearcat-0.9.4 spec/bearcat/client/courses_spec.rb
bearcat-0.9.3 spec/bearcat/client/courses_spec.rb
bearcat-0.9.2 spec/bearcat/client/courses_spec.rb
bearcat-0.9.1 spec/bearcat/client/courses_spec.rb
bearcat-0.9 spec/bearcat/client/courses_spec.rb