Class: TestParameters
Defined Under Namespace
Classes: FakeSafeBuffer
Instance Method Summary
collapse
#capture_warnings, jruby?, rbx?, ssl_mode?, #test_default
#live_server, #live_server=, #live_server?
Instance Method Details
#test_decode_array_flat ⇒ Object
45
46
47
48
49
|
# File 'test/parameters_test.rb', line 45
def test_decode_array_flat
query = "a=one&a=two&a=three"
expected = {"a" => ["one", "two", "three"]}
assert_equal expected, Faraday::FlatParamsEncoder.decode(query)
end
|
#test_decode_array_nested ⇒ Object
39
40
41
42
43
|
# File 'test/parameters_test.rb', line 39
def test_decode_array_nested
query = "a[1]=one&a[2]=two&a[3]=three"
expected = {"a" => ["one", "two", "three"]}
assert_equal expected, Faraday::NestedParamsEncoder.decode(query)
end
|
#test_encode_nil_flat ⇒ Object
#test_encode_nil_nested ⇒ Object
#test_escaping_safe_buffer_flat ⇒ Object
#test_escaping_safe_buffer_nested ⇒ Object
#test_nested_decode_hash ⇒ Object
51
52
53
54
55
|
# File 'test/parameters_test.rb', line 51
def test_nested_decode_hash
query = "a[b1]=one&a[b2]=two&a[b][c]=foo"
expected = {"a" => {"b1" => "one", "b2" => "two", "b" => {"c" => "foo"}}}
assert_equal expected, Faraday::NestedParamsEncoder.decode(query)
end
|
#test_raises_typeerror_flat ⇒ Object
32
33
34
35
36
37
|
# File 'test/parameters_test.rb', line 32
def test_raises_typeerror_flat
error = assert_raises TypeError do
Faraday::FlatParamsEncoder.encode("")
end
assert_equal "Can't convert String into Hash.", error.message
end
|
#test_raises_typeerror_nested ⇒ Object
25
26
27
28
29
30
|
# File 'test/parameters_test.rb', line 25
def test_raises_typeerror_nested
error = assert_raises TypeError do
Faraday::NestedParamsEncoder.encode("")
end
assert_equal "Can't convert String into Hash.", error.message
end
|