Sha256: 805072d2cda6a2c1dd4d42ddd58f5bf723336ceaa78d5a91879b518e88758c79
Contents?: true
Size: 1.36 KB
Versions: 11
Compression:
Stored size: 1.36 KB
Contents
require 'helper' class TestPush < Test::Unit::TestCase def setup Parse.init end def test_save_without_where data = {:foo => 'bar', :alert => 'message'} pf_push = Parse::Push.new(data, "some_chan") pf_push.type = 'ios' query = Parse::Query.new(Parse::Protocol::CLASS_INSTALLATION).eq('deviceToken', 'baz') Parse::Client.any_instance.expects(:request).with do |uri, method, body, query| hash = JSON.parse(body) assert_equal :post, method assert has_entries('type' => 'ios', 'channel' => "some_chan").matches?([hash]) assert has_entries('foo' => 'bar', 'alert' => 'message').matches?([hash['data']]) assert_nil query true end.returns({}.to_json) pf_push.save end def test_save_with_where_removes_channel data = {:foo => 'bar', :alert => 'message'} pf_push = Parse::Push.new(data, "some_chan") pf_push.type = 'ios' query = Parse::Query.new(Parse::Protocol::CLASS_INSTALLATION).eq('deviceToken', 'baz') pf_push.where = query.where Parse::Client.any_instance.expects(:request).with do |uri, method, body, query| hash = JSON.parse(body) assert_false has_entries('channel' => "some_chan").matches?([hash]) assert has_entries('deviceToken' => 'baz').matches?([hash['where']]) true end.returns({}.to_json) pf_push.save end end
Version data entries
11 entries across 11 versions & 1 rubygems