Sha256: e4305c273d7cf8ed61a223ae344d438339530d265c3047bfa826babc3c241ff7

Contents?: true

Size: 1.17 KB

Versions: 30

Compression:

Stored size: 1.17 KB

Contents

require 'helper'

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

  it "returns a courses quizzes" do
    stub_get(@client, "/api/v1/courses/1/quizzes").to_return(json_response("quizzes/course_quizzes.json"))
    course_quizzes = @client.list_course_quizzes('1')
    course_quizzes.class.should eq(Bearcat::ApiArray)
    course_quizzes.count.should == 2
    course_quizzes.first['id'].should == 37
    course_quizzes.last['id'].should == 38
  end

  it "returns a single quiz" do
    stub_get(@client, "/api/v1/courses/1/quizzes/38").to_return(json_response("quizzes/course_quiz.json"))
    course_quiz = @client.quiz('1', '38')
    course_quiz.class.should eq(Hash)
    course_quiz['id'].should == 38
  end

  it 'sets extensions on a quiz' do
    stub_post(@client, "/api/v1/courses/1/quizzes/1/extensions").to_return(json_response("quizzes/quiz_extension.json"))
    quiz_extension = @client.quiz_extensions('1', '1', {quiz_extensions: [{user_id: 1}, {extra_time: 30}]})
    quiz_extension.class.should eq(Hash)
    quiz_extension['quiz_extensions'].first['extra_time'].should eq(30)
  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
bearcat-1.2.1 spec/bearcat/client/quizzes_spec.rb
bearcat-1.2.0 spec/bearcat/client/quizzes_spec.rb
bearcat-1.1.1 spec/bearcat/client/quizzes_spec.rb
bearcat-1.1.0 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.28 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.27 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.26 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.25 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.24 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.23 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.22 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.21 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.20 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.19 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.18 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.17 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.16 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.15 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.14 spec/bearcat/client/quizzes_spec.rb
bearcat-1.0.13 spec/bearcat/client/quizzes_spec.rb