| Server IP : 68.178.247.200 / Your IP : 216.73.216.110 Web Server : Apache System : Linux p3plzcpnl489463.prod.phx3.secureserver.net 4.18.0-553.126.2.lve.el8.x86_64 #1 SMP Thu May 28 14:12:30 UTC 2026 x86_64 User : x9dppmxs4rgd ( 8559391) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/opt/alt/ruby32/share/gems/gems/rest-client-2.1.0/spec/unit/ |
Upload File : |
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