Sha256: 56462c82d8224dbc53f0764bb086729747cffa883673273f42e56738cf3c569f
Contents?: true
Size: 1.09 KB
Versions: 5
Compression:
Stored size: 1.09 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_users(1, {"enrollment_type" => "student"}) students['name'].should == 'test@student.com' students['id'].should == 2 end end
Version data entries
5 entries across 5 versions & 1 rubygems