Sha256: 9718695746fca746302feea4d91d64fc82af276aaf4cbd69c5a70da1d4829a7e

Contents?: true

Size: 1.67 KB

Versions: 71

Compression:

Stored size: 1.67 KB

Contents

require 'helper'

describe Bearcat::Client::Rubric do
  before do
    @client = Bearcat::Client.new(prefix:"http://canvas.instructure.com", token: "test_token")
  end

  it "returns a rubric for a course" do
    stub_get(@client, "/api/v1/courses/72/rubrics/1").to_return(json_response("rubric.json"))
    rubric = @client.course_rubric(72, 1)
    rubric['id'].should == 1
    rubric['title'].should == 'Rubric title'
    rubric['context_type'].should == 'Course'
    rubric['points_possible'].should == 10
  end

  it "creates a rubric" do
    stub_post(@client, "/api/v1/courses/72/rubrics").
      with(:body => {"rubric_assessment"=>{"user_id"=>"22"}}).to_return(json_response("rubric.json"))
    rubric = @client.create_course_rubric(72, {rubric_assessment: {user_id: "22"}})
    rubric['id'].should == 1
    rubric['title'].should == 'Rubric title'
    rubric['context_type'].should == 'Course'
    rubric['points_possible'].should == 10
  end

  it "updates a rubric" do
    stub_put(@client, "/api/v1/courses/72/rubrics/1")
      .with(:body => {"rubric_assessment"=>{"user_id"=>"22"}}).to_return(json_response("rubric.json"))
    rubric = @client.update_course_rubric(72, 1, {rubric_assessment: {user_id: "22"}})
    rubric['id'].should == 1
    rubric['title'].should == 'Rubric title'
    rubric['context_type'].should == 'Course'
    rubric['points_possible'].should == 10
  end

  it "deletes a rubric" do
    stub_delete(@client, "/api/v1/courses/72/rubrics/1").to_return(json_response("rubric.json"))
    rubric = @client.delete_course_rubric(72, 1)
    rubric['title'].should == 'Rubric title'
    rubric['context_type'].should == 'Course'
    rubric['points_possible'].should == 10
  end

end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
bearcat-1.5.13 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.12 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.11 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.10 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.9 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.8 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.7 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.6 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.5 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.4 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.3 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.2 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.0 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.0.beta4 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.0.beta3 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.0.beta2 spec/bearcat/client/rubric_spec.rb
bearcat-1.5.0.beta1 spec/bearcat/client/rubric_spec.rb
bearcat-1.4.13 spec/bearcat/client/rubric_spec.rb
bearcat-1.4.12 spec/bearcat/client/rubric_spec.rb
bearcat-1.4.11 spec/bearcat/client/rubric_spec.rb