spec/bearcat/client/modules_spec.rb in bearcat-1.3.39 vs spec/bearcat/client/modules_spec.rb in bearcat-1.3.40

- old
+ new

@@ -31,13 +31,31 @@ describe "#create_module" do it "creates a new module" do name = "new module" stub_request(:post, "http://canvas.instructure.com/api/v1/courses/1/modules") - .with(body: {"name"=>"new module"}) + .with(body: {"name"=> name}) .to_return(json_response("created_module.json")) course_module = @client.create_module(1, { name: name }) course_module["name"].should == name course_module["id"].should == 1 + end + end + + describe "#update_module" do + it "updates a module" do + stub_request(:put, "http://canvas.instructure.com/api/v1/courses/3/modules/2") + .to_return(json_response("module.json")) + updated_module = @client.update_module(3, 2, {}) + expect(updated_module['name']).to eq("Second Module") + expect(updated_module['id']).to eq(2) + end + end + + describe "#delete_module" do + it "deletes a module" do + stub_delete(@client, "/api/v1/courses/3/modules/2").to_return(json_response("module.json")) + course_module = @client.delete_module(3, 2) + expect(course_module["id"]).to eq(2) end end end