Sha256: 5ca18a7536aef940da97a006dd1ec7f3cfb8ea98a5c7606a59792246a6f48d92

Contents?: true

Size: 993 Bytes

Versions: 30

Compression:

Stored size: 993 Bytes

Contents

require 'sinatra/base'

# Canvas responses can be mocked out here. You can get the correct
# format by hitting a real Canvas API for the route you're looking at,
# and then save the result as a .json file in spec/support/fixtures/canvas_responses
class FakeCanvas < Sinatra::Base
  get '/api/v1/accounts/self/terms' do
    json_response 200, 'terms.json'
  end

  get '/api/v1/accounts/self/roles' do
    json_response 200, 'roles.json'
  end

  get '/api/v1/accounts/self/admins' do
    json_response 200, 'admins.json'
  end

  get '/sample_report_download' do
    json_response 200, 'terms.json'
  end

  get '/api/v1/courses/1/modules/1' do
    json_response 200, 'module.json'
  end

  get '/api/v1/courses/1/modules/1/items/1' do
    json_response 200, 'module_item.json'
  end

  private

  def json_response(response_code, file_name)
    content_type :json
    status response_code
    File.open(File.dirname(__FILE__) + '/fixtures/canvas_responses/' + file_name, 'rb').read
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
canvas_sync-0.10.6 spec/support/fake_canvas.rb
canvas_sync-0.10.5 spec/support/fake_canvas.rb
canvas_sync-0.10.4 spec/support/fake_canvas.rb
canvas_sync-0.10.3 spec/support/fake_canvas.rb
canvas_sync-0.10.2 spec/support/fake_canvas.rb
canvas_sync-0.10.0 spec/support/fake_canvas.rb
canvas_sync-0.9.4 spec/support/fake_canvas.rb
canvas_sync-0.9.3 spec/support/fake_canvas.rb
canvas_sync-0.9.2 spec/support/fake_canvas.rb
canvas_sync-0.9.1 spec/support/fake_canvas.rb
canvas_sync-0.9.0 spec/support/fake_canvas.rb
canvas_sync-0.8.4 spec/support/fake_canvas.rb
canvas_sync-0.8.3 spec/support/fake_canvas.rb
canvas_sync-0.8.2 spec/support/fake_canvas.rb
canvas_sync-0.8.1 spec/support/fake_canvas.rb
canvas_sync-0.8.0 spec/support/fake_canvas.rb
canvas_sync-0.7.3 spec/support/fake_canvas.rb
canvas_sync-0.7.2 spec/support/fake_canvas.rb
canvas_sync-0.7.1 spec/support/fake_canvas.rb
canvas_sync-0.7.0 spec/support/fake_canvas.rb