Sha256: 638dc1d1e649e471d614d2784506adf1227d6ff03d0675c407bf50e4af237530

Contents?: true

Size: 857 Bytes

Versions: 49

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe LHC::Request do
  context 'without an encoding setting' do
    it 'encodes array params in default rack format' do
      stub_request(:get, 'http://datastore/q?a%5B%5D=1&a%5B%5D=2&a%5B%5D=3')
      LHC.get('http://datastore/q', params: { a: [1, 2, 3] })
    end
  end

  context 'with encoding set to :rack' do
    it 'encodes array params in rack format' do
      stub_request(:get, 'http://datastore/q?a%5B%5D=1&a%5B%5D=2&a%5B%5D=3')
      LHC.get('http://datastore/q', params: { a: [1, 2, 3] }, params_encoding: :rack)
    end
  end

  context 'with encoding set to :multi' do
    it 'encodes array params in multi format' do
      stub_request(:get, 'http://datastore/q?a=1&a=2&a=3')
      LHC.get('http://datastore/q', params: { a: [1, 2, 3] }, params_encoding: :multi)
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
lhc-15.2.1 spec/request/params_encoding_spec.rb
lhc-15.2.0 spec/request/params_encoding_spec.rb
lhc-15.1.3 spec/request/params_encoding_spec.rb
lhc-15.1.2 spec/request/params_encoding_spec.rb
lhc-15.1.1 spec/request/params_encoding_spec.rb
lhc-15.1.0 spec/request/params_encoding_spec.rb
lhc-16.0.0.pre.pro2162.2 spec/request/params_encoding_spec.rb
lhc-16.0.0.pre.pro2162 spec/request/params_encoding_spec.rb
lhc-15.0.1 spec/request/params_encoding_spec.rb
lhc-15.0.0 spec/request/params_encoding_spec.rb
lhc-14.0.0 spec/request/params_encoding_spec.rb
lhc-13.4.0.pre.pro1766.1 spec/request/params_encoding_spec.rb
lhc-13.2.0 spec/request/params_encoding_spec.rb
lhc-13.1.0 spec/request/params_encoding_spec.rb
lhc-13.0.0 spec/request/params_encoding_spec.rb
lhc-12.3.0 spec/request/params_encoding_spec.rb
lhc-12.2.1 spec/request/params_encoding_spec.rb
lhc-12.2.0 spec/request/params_encoding_spec.rb
lhc-12.1.3 spec/request/params_encoding_spec.rb
lhc-12.1.2 spec/request/params_encoding_spec.rb