|
355 | 355 | end
|
356 | 356 |
|
357 | 357 | context 'when there is a port specified \'http://myhost:7101\'' do
|
358 |
| - |
359 | 358 | let(:host) do
|
360 | 359 | 'http://myhost:7101'
|
361 | 360 | end
|
|
373 | 372 | end
|
374 | 373 |
|
375 | 374 | context 'when there is a path specified \'http://myhost:7101/api\'' do
|
376 |
| - |
377 | 375 | let(:host) do
|
378 | 376 | 'http://myhost:7101/api'
|
379 | 377 | end
|
|
405 | 403 | end
|
406 | 404 |
|
407 | 405 | context 'when the protocol is https' do
|
408 |
| - |
409 | 406 | context 'when there is no port specified \'https://myhost\'' do
|
410 |
| - |
411 | 407 | let(:host) do
|
412 | 408 | 'https://myhost'
|
413 | 409 | end
|
|
426 | 422 | end
|
427 | 423 |
|
428 | 424 | context 'when there is a port specified \'https://myhost:7101\'' do
|
429 |
| - |
430 | 425 | let(:host) do
|
431 | 426 | 'https://myhost:7101'
|
432 | 427 | end
|
|
828 | 823 | end
|
829 | 824 |
|
830 | 825 | context 'when the hosts is invalid' do
|
831 |
| - |
832 | 826 | let(:host) do
|
833 | 827 | 123
|
834 | 828 | end
|
|
842 | 836 | end
|
843 | 837 |
|
844 | 838 | context 'when hosts are specified with the \'host\' key' do
|
845 |
| - |
846 | 839 | let(:client) do
|
847 | 840 | described_class.new(host: ['host1', 'host2', 'host3', 'host4'], randomize_hosts: true)
|
848 | 841 | end
|
|
857 | 850 | end
|
858 | 851 |
|
859 | 852 | context 'when hosts are specified with the \'host\' key as a String' do
|
860 |
| - |
861 | 853 | let(:client) do
|
862 | 854 | described_class.new('host' => ['host1', 'host2', 'host3', 'host4'], 'randomize_hosts' => true)
|
863 | 855 | end
|
|
872 | 864 | end
|
873 | 865 |
|
874 | 866 | context 'when hosts are specified with the \'hosts\' key' do
|
875 |
| - |
876 | 867 | let(:client) do
|
877 | 868 | described_class.new(hosts: host)
|
878 | 869 | end
|
|
885 | 876 | end
|
886 | 877 |
|
887 | 878 | context 'when hosts are specified with the \'hosts\' key as a String' do
|
888 |
| - |
889 | 879 | let(:client) do
|
890 | 880 | described_class.new('hosts' => host)
|
891 | 881 | end
|
|
898 | 888 | end
|
899 | 889 |
|
900 | 890 | context 'when hosts are specified with the \'url\' key' do
|
901 |
| - |
902 | 891 | let(:client) do
|
903 | 892 | described_class.new(url: host)
|
904 | 893 | end
|
|
911 | 900 | end
|
912 | 901 |
|
913 | 902 | context 'when hosts are specified with the \'url\' key as a String' do
|
914 |
| - |
915 | 903 | let(:client) do
|
916 | 904 | described_class.new('url' => host)
|
917 | 905 | end
|
|
924 | 912 | end
|
925 | 913 |
|
926 | 914 | context 'when hosts are specified with the \'urls\' key' do
|
927 |
| - |
928 | 915 | let(:client) do
|
929 | 916 | described_class.new(urls: host)
|
930 | 917 | end
|
|
937 | 924 | end
|
938 | 925 |
|
939 | 926 | context 'when hosts are specified with the \'urls\' key as a String' do
|
940 |
| - |
941 | 927 | let(:client) do
|
942 | 928 | described_class.new('urls' => host)
|
943 | 929 | end
|
|
1134 | 1120 | end
|
1135 | 1121 |
|
1136 | 1122 | context 'when \'request_timeout\' is defined' do
|
1137 |
| - |
1138 | 1123 | let(:client) do
|
1139 | 1124 | described_class.new(request_timeout: 120)
|
1140 | 1125 | end
|
|
1145 | 1130 | end
|
1146 | 1131 |
|
1147 | 1132 | context 'when \'request_timeout\' is defined as a String key' do
|
1148 |
| - |
1149 | 1133 | let(:client) do
|
1150 | 1134 | described_class.new('request_timeout' => 120)
|
1151 | 1135 | end
|
|
1157 | 1141 | end
|
1158 | 1142 |
|
1159 | 1143 | describe '#perform_request' do
|
1160 |
| - |
1161 | 1144 | let(:transport_instance) do
|
1162 | 1145 | Class.new { def initialize(*); end }.new
|
1163 | 1146 | end
|
|
1172 | 1155 | end
|
1173 | 1156 |
|
1174 | 1157 | context 'when the \'send_get_body_as\' option is specified' do
|
1175 |
| - |
1176 | 1158 | let(:client) do
|
1177 | 1159 | described_class.new(transport: transport_instance, :send_get_body_as => 'POST')
|
1178 | 1160 | end
|
1179 | 1161 |
|
1180 | 1162 | before do
|
1181 |
| - expect(transport_instance).to receive(:perform_request).with('POST', '/', {}, |
1182 |
| - '{"foo":"bar"}', |
1183 |
| - '{"Content-Type":"application/x-ndjson"}').and_return(true) |
| 1163 | + expect(transport_instance).to receive(:perform_request) |
| 1164 | + .with( |
| 1165 | + 'POST', '/', {}, |
| 1166 | + '{"foo":"bar"}', |
| 1167 | + '{"Content-Type":"application/x-ndjson"}' |
| 1168 | + ).and_return(true) |
1184 | 1169 | end
|
1185 | 1170 |
|
1186 | 1171 | let(:request) do
|
|
0 commit comments