Sha256: 8ad51e0327c2f3d52027ba8c443821edad702af53ca71913201f7ae82abe2636
Contents?: true
Size: 965 Bytes
Versions: 49
Compression:
Stored size: 965 Bytes
Contents
# frozen_string_literal: true require 'rails_helper' describe LHC::Request do context 'encode body' do let(:encoded_data) { data.to_json } before do stub_request(:post, "http://datastore/q") .with(body: encoded_data) .to_return(status: 200) end context 'hash' do let(:data) { { name: 'Steve' } } it 'encodes the request body to the given format' do LHC.post('http://datastore/q', body: data) end it 'does not encode the request body if it is already a string' do LHC.post('http://datastore/q', body: encoded_data) end end context 'array' do let(:data) { [{ name: 'Steve' }] } it 'encodes the request body to the given format' do LHC.post('http://datastore/q', body: data) end it 'does not encode the request body if it is already a string' do LHC.post('http://datastore/q', body: encoded_data) end end end end
Version data entries
49 entries across 49 versions & 1 rubygems