Sha256: 3b669bce20add5c737f1be30e15915a99bfa463f6078b193bf8e0069231b73b5
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 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) expect(course['name']).to eq('Course 3') expect(course['id']).to eq(3) expect(course['start_at']).to eq('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}) expect(course['name']).to eq(name) expect(course['id']).to eq(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"}) expect(students['name']).to eq('test@student.com') expect(students['id']).to eq(2) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bearcat-0.1.1 | spec/bearcat/client/courses_spec.rb |
bearcat-0.1 | spec/bearcat/client/courses_spec.rb |