spec/api_client_spec.rb in dkron-rb-1.0.0 vs spec/api_client_spec.rb in dkron-rb-1.1.0

- old
+ new

@@ -4,11 +4,11 @@ #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response. OpenAPI spec version: 1 Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.2 +Swagger Codegen version: 2.4.18 =end require 'spec_helper' @@ -84,9 +84,26 @@ it 'can be customized' do config.timeout = 100 request = api_client.build_request(:get, '/test') expect(request.options[:timeout]).to eq(100) + end + end + + describe '#build_request' do + let(:config) { Dkron::Configuration.new } + let(:api_client) { Dkron::ApiClient.new(config) } + + it 'does not send multipart to request' do + expect(Typhoeus::Request).to receive(:new).with(anything, hash_not_including(:multipart)) + api_client.build_request(:get, '/test') + end + + context 'when the content type is multipart' do + it 'sends multipart to request' do + expect(Typhoeus::Request).to receive(:new).with(anything, hash_including(multipart: true)) + api_client.build_request(:get, '/test', {header_params: { 'Content-Type' => 'multipart/form-data'}}) + end end end describe '#deserialize' do it "handles Array<Integer>" do