spec/acceptance/realtime/push_admin_spec.rb in ably-1.1.4.rc vs spec/acceptance/realtime/push_admin_spec.rb in ably-1.1.4
- old
+ new
@@ -99,34 +99,18 @@
else
'application/json'
end
end
- def request_body(request, protocol)
- if protocol == :msgpack
- MessagePack.unpack(request.body)
- else
- JSON.parse(request.body)
- end
- end
-
- def serialize(object, protocol)
- if protocol == :msgpack
- MessagePack.pack(object)
- else
- JSON.dump(object)
- end
- end
-
let!(:publish_stub) do
stub_request(:post, "#{client.rest_client.endpoint}/push/publish").
with do |request|
- expect(request_body(request, protocol)['recipient']['camelCase']['secondLevelCamelCase']).to eql('val')
- expect(request_body(request, protocol)['recipient']).to_not have_key('camel_case')
+ expect(deserialize_body(request.body, protocol)['recipient']['camelCase']['secondLevelCamelCase']).to eql('val')
+ expect(deserialize_body(request.body, protocol)['recipient']).to_not have_key('camel_case')
true
end.to_return(
:status => 201,
- :body => serialize({}, protocol),
+ :body => serialize_body({}, protocol),
:headers => { 'Content-Type' => content_type }
)
end
it 'is converted to snakeCase' do