🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

mock_gcm

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mock_gcm

0.2.0
Rubygems
Version published
Maintainers
1
Created
Source

MockGcm

Fake GCM server for your integration testing needs.

Please be aware that this does not test everything as specific tests for errors like InvalidTtl, DataTooBig, InvalidRegistration are not made - but their results can be mocked.

Installation

Add this line to your application's Gemfile:

gem 'mock_gcm'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mock_gcm

Usage

require 'mock_gcm'

mock_gcm = MockGCM.new("my key", 8282)
mock_gcm.start

require 'gcm_client' # some gcm client library
client = GcmClient.new(:url => "http://localhost:8282/", :api_key => "my key")
client.send("registration_id1", {:some => :data})
client.send("registration_id2", {:some => :data})

mock_gcm.received_messages =>
# => [
#        {
#          "collapse_key"     => nil,
#          "time_to_live"     => nil,
#          "delay_while_idle" => nil,
#          "data"             => {"some" => "data"},
#          "registration_id" =>  "registration_id1"
#        }, {
#          "collapse_key"     => nil,
#          "time_to_live"     => nil,
#          "delay_while_idle" => nil,
#          "data"             => {"some" => "data"},
#          "registration_id" =>  "registration_id2"
#        }
#    ]

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 22 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

OSZAR »