Sha256: de497139258d79e521867837fde5070df50e7f863e3ebbd96ee1c00fa2995e06
Contents?: true
Size: 937 Bytes
Versions: 33
Compression:
Stored size: 937 Bytes
Contents
describe QuizApiClient::Services::SessionItemsService do let(:host) { 'api.host' } let(:config) { QuizApiClient::Config.new { |c| c.host = host } } let(:subject) { described_class.new(config) } describe '#index' do let(:params) { { quiz_session_id: 1 } } let(:stubbed_response) { { 'id' => '1_1', 'item' => { 'id' => '1' } } } let(:expected_url) { "https://#{host}/api/quiz_sessions/#{params[:quiz_session_id]}/session_items" } let(:status_code) { 200 } before do stub_request(:get, expected_url) .to_return( status: status_code, body: stubbed_response.to_json, headers: { 'Content-Type' => 'application/json' } ) end it 'gets from quiz_api/api/quiz_sessions/:id/session_items and returns the response' do result = subject.list(params: params, token: 'token') expect(result.parsed_response).to eql(stubbed_response) end end end
Version data entries
33 entries across 33 versions & 1 rubygems