Sha256: 02494523ffaacb023aba2ca5982dfbd877282a9017b3657c9d833dfbe9c85cd6
Contents?: true
Size: 992 Bytes
Versions: 5
Compression:
Stored size: 992 Bytes
Contents
RSpec.describe QuizApiClient::Services::AccountService do let(:host) { 'api.host' } let(:config) { QuizApiClient::Config.new { |c| c.host = host } } let(:subject) { described_class.new(config) } describe '#update' do let(:params) do { tenant_domain: 'foo.instructure.com' } end let(:response) do { 'id' => '1', 'uuid' => '5862e3c7-b598-40c8-996f-cd0cd1778358', 'tenant_domain' => params[:tenant_domain] } end let(:expected_url) { "https://#{host}/api/account" } before do stub_request(:patch, expected_url) .with(body: { account: params }.to_json) .to_return( status: 200, body: response.to_json, headers: { 'Content-Type' => 'application/json' } ) end it 'pathces to the correct endpoint and returns the response' do expect( subject.update(params: params, token: 'token').parsed_response ).to eq(response) end end end
Version data entries
5 entries across 5 versions & 1 rubygems