Sha256: 439c21bf8557c555446672e85c2ef0fd65f62f3c30c756c257348904adec21dc

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'helper'

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

  it "returns an outcome" do
    stub_get(@client, "/api/v1/outcomes/1").to_return(json_response("outcomes.json"))
    outcome = @client.show_outcome(1)
    expect(outcome['title']).to eq('Test Outcome title')
    expect(outcome['id']).to eq(1)
    expect(outcome['description']).to eq('Test Outcome description')
    expect(outcome['points_possible']).to eq(5)
    expect(outcome['mastery_points']).to eq(3)
  end

  it "updates an outcome" do
    title = 'updated outcome title'
    description = 'updated outcome desc'
    stub_put(@client, "/api/v1/outcomes/5").with(:body => {"title" => title, "description" => description}).to_return(json_response("update_outcome.json"))
    outcome = @client.update_outcome(5, {"title" => title, "description" => description})
    expect(outcome['title']).to eq(title)
    expect(outcome['description']).to eq(description)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bearcat-0.1.1 spec/bearcat/client/outcomes_spec.rb
bearcat-0.1 spec/bearcat/client/outcomes_spec.rb