Sha256: d7cfac517f4318bf4a560027d400423170181b32b44d94bff7cd500d968ca0b6
Contents?: true
Size: 938 Bytes
Versions: 11
Compression:
Stored size: 938 Bytes
Contents
describe QuizApiClient::Services::AnalysesService 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 { quiz_id: 1, quiz_session_ids: [1, 5, 10], filter: :last_attempt } end let(:stubbed_response) { { 'job_id' => 1 } } let(:expected_url) { "https://#{host}/api/quizzes/#{params[:quiz_id]}/analyses" } let(:status_code) { 200 } before do stub_request(:post, expected_url) .to_return( status: status_code, body: stubbed_response.to_json, headers: { 'Content-Type' => 'application/json' } ) end it 'posts to quiz_api/api/quizzes/{id}/analyses and returns the response' do result = subject.create(params: params, token: 'token') expect(result.parsed_response).to eql(stubbed_response) end end end
Version data entries
11 entries across 11 versions & 1 rubygems