test/angelo/params_spec.rb in angelo-0.1.15 vs test/angelo/params_spec.rb in angelo-0.1.16
- old
+ new
@@ -58,9 +58,28 @@
parser.json = true
parser.body = json_params
parser.parse_post_body.must_equal post_params
end
+ it 'recursively symhashes JSON POST bodies params' do
+ nested = {
+ foo: {
+ bar: 'baz',
+ that: {
+ holmes: true
+ }
+ }
+ }
+ parser.form_encoded = false
+ parser.json = true
+ parser.body = nested.to_json
+ parsed = parser.parse_post_body
+ parsed['foo']['bar'].must_equal 'baz'
+ parsed[:foo][:bar].must_equal 'baz'
+ assert parsed['foo']['that']['holmes']
+ assert parsed[:foo][:that][:holmes]
+ end
+
it 'should override query string with JSON POST bodies params' do
parser.form_encoded = false
parser.json = true
parser.query_string = get_params
parser.body = json_params