Sha256: 64c0df4c73c715b4e097761cdfdd31c3e63539ffffcf685f59ef56737a7b6eab
Contents?: true
Size: 1.3 KB
Versions: 6
Compression:
Stored size: 1.3 KB
Contents
describe QuizApiClient::Services::ContentExportsService do let(:host) { 'api.host' } let(:config) { QuizApiClient::Config.new { |c| c.host = host } } let(:subject) { described_class.new(config) } describe '#create' do let(:params) do { canvas_content_export_id: 1234, export_settings: { quizzes: [10, 11], everything: false, content_export_type: 'qti' } } end let(:response) do { 'id' => '1', 'canvas_content_export_id' => '1234', 'export_settings' => { 'quizzes' => [10, 11], 'everything' => false, 'content_export_type' => 'qti' }, 'created_at' => '2023-02-17T01:00:00.000Z', 'updated_at' => '2023-02-17T01:00:00.000Z' } end let(:expected_url) { "https://#{host}/api/content_exports" } before do stub_request(:post, expected_url) .with(body: { content_export: params }.to_json) .to_return( status: 201, body: response.to_json, headers: { 'Content-Type' => 'application/json' } ) end it 'posts to the correct endpoint and returns the response' do expect( subject.create(params: params, token: 'token').parsed_response ).to eq(response) end end end
Version data entries
6 entries across 6 versions & 1 rubygems