Sha256: fa56f80b47e453e3adb42dceb81cb4769b8daf2b581e6a1cdbf8b985bde713c3

Contents?: true

Size: 1.08 KB

Versions: 93

Compression:

Stored size: 1.08 KB

Contents

require_relative '_lib'

describe RestClient::ParamsArray do

  describe '.new' do
    it 'accepts various types of containers' do
      as_array = [[:foo, 123], [:foo, 456], [:bar, 789], [:empty, nil]]
      [
        [[:foo, 123], [:foo, 456], [:bar, 789], [:empty, nil]],
        [{foo: 123}, {foo: 456}, {bar: 789}, {empty: nil}],
        [{foo: 123}, {foo: 456}, {bar: 789}, {empty: nil}],
        [{foo: 123}, [:foo, 456], {bar: 789}, {empty: nil}],
        [{foo: 123}, [:foo, 456], {bar: 789}, [:empty]],
      ].each do |input|
        expect(RestClient::ParamsArray.new(input).to_a).to eq as_array
      end

      expect(RestClient::ParamsArray.new([]).to_a).to eq []
      expect(RestClient::ParamsArray.new([]).empty?).to eq true
    end

    it 'rejects various invalid input' do
      expect {
        RestClient::ParamsArray.new([[]])
      }.to raise_error(IndexError)

      expect {
        RestClient::ParamsArray.new([[1,2,3]])
      }.to raise_error(ArgumentError)

      expect {
        RestClient::ParamsArray.new([1,2,3])
      }.to raise_error(NoMethodError)
    end
  end
end

Version data entries

93 entries across 68 versions & 4 rubygems

Version Path
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/bundle/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.9 vendor/bundle/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.8 vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.8 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.8 vendor/bundle/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/rest-client-2.0.2/spec/unit/params_array_spec.rb
paynow_sdk-1.0.7 vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.7 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.6 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.6 vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.5 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.5 vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb
paynow_sdk-1.0.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/rest-client-2.1.0/spec/unit/params_array_spec.rb