spec/bearcat/client/modules_spec.rb in bearcat-1.3.38 vs spec/bearcat/client/modules_spec.rb in bearcat-1.3.39
- old
+ new
@@ -26,7 +26,18 @@
stub_get(@client, "/api/v1/courses/1/modules/2").to_return(json_response("module.json"))
context_module = @client.course_module(1, 2)
expect(context_module['id']).to eq(2)
end
end
-end
+ 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"})
+ .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
+end