Sha256: f48920b41e92c6e2e10d131f7798dd9a773fa89c35f44879f7f01c09b6532535
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'helper' class TestPush < AVTestCase def test_save_without_where data = {:foo => 'bar', :alert => 'message'} pf_push = AV::Push.new(data, "some_chan") pf_push.type = 'ios' query = AV::Query.new(AV::Protocol::CLASS_INSTALLATION).eq('deviceToken', 'baz') AV::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 = AV::Push.new(data, "some_chan") pf_push.type = 'ios' query = AV::Query.new(AV::Protocol::CLASS_INSTALLATION).eq('deviceToken', 'baz') pf_push.where = query.where AV::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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
leancloud-ruby-client-0.1.1 | test/test_push.rb |
leancloud-ruby-client-0.1.0 | test/test_push.rb |