require 'helper' describe Bearcat::Client::Discussions do before do @client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token") end it "creates a new group discussion" do title = "This is a group discussion" stub_post(@client, "/api/v1/groups/2/discussion_topics").with(body: {"title" => title}).to_return(json_response("create_group_discussion.json")) discussion = @client.create_group_discussion(2, {'title' => title}) discussion['title'].should == 'This is a group discussion' end it 'creates a new course discussion' do title = "This is a course discussion" stub_post(@client, "/api/v1/courses/2/discussion_topics").with(body: {"title" => title}).to_return(json_response("create_course_discussion.json")) discussion = @client.create_course_discussion(2, {'title' => title}) discussion['title'].should == 'This is a course discussion' end end