spec/batch_spec.rb in notifiable-gcm-spacialdb-0.2.0 vs spec/batch_spec.rb in notifiable-gcm-spacialdb-0.2.1

- old
+ new

@@ -14,9 +14,22 @@ g.close Notifiable::NotificationDeviceToken.count.should == 1 end + it "sends custom attributes" do + n.update_attribute(:payload, {:gcm => {:data => {:custom_id => 123456}}}) + + stub_request(:post, "https://android.googleapis.com/gcm/send") + .with(:body => {:registration_ids => ["ABC123"], :data => {:message => n.message, :custom_id => 123456}}) + .to_return(:body => '{ "multicast_id": 108, "success": 1, "failure": 0, "canonical_ids": 0, "results": [{ "message_id": "1:08" }]}') + + g.send_notification(n, d) + g.close + + Notifiable::NotificationDeviceToken.count.should == 1 + end + it "sends a single gcm notification in a batch" do stub_request(:post, "https://android.googleapis.com/gcm/send").to_return(:body => '{ "multicast_id": 108, "success": 1, "failure": 0, "canonical_ids": 0, "results": [{ "message_id": "1:08" }]}') Notifiable.batch {|b| b.add(n, u)} \ No newline at end of file