Sha256: 2f4bc59d217a27f02e04c70e9c86518f08ce021c32adaca861573347defb8e8e

Contents?: true

Size: 898 Bytes

Versions: 3

Compression:

Stored size: 898 Bytes

Contents

require 'rails_helper'

describe LHC do
  context 'plain' do
    let(:file) do
      ActionDispatch::Http::UploadedFile.new(
        tempfile: Tempfile.new,
        filename: 'image.jpg',
        type: 'image/jpeg',
        head: %q{Content-Disposition: form-data; name="files[]"; filename="image.jpg"\r\nContent-Type: image/jpeg\r\n}
      )
    end

    it 'leaves plains requests unformatted' do
      stub_request(:post, 'http://local.ch/')
        .with(body: /file=%23%3CActionDispatch%3A%3AHttp%3A%3AUploadedFile%3A.*%3E&type=Image/)
        .to_return do |request|
          expect(request.headers['Content-Type']).to be_blank

          { status: 204 }
        end
      response = LHC.plain.post(
        'http://local.ch',
        body: { file: file, type: 'Image' }
      )
      expect(lambda {
        response.body
        response.data
      }).not_to raise_error
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lhc-10.1.2 spec/formats/plain_spec.rb
lhc-10.1.1 spec/formats/plain_spec.rb
lhc-10.1.0 spec/formats/plain_spec.rb