Sha256: 5c624aa25f380548f51d15b93fe9c669765f53db3229887f5c91e9f145ee6adf

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe ZeroPush do
  before do
    ZeroPush.auth_token = ENV["AUTH_TOKEN"] || "test_token"
  end

  describe "/verify_credentials" do
    before do
      VCR.insert_cassette "verify_credentials"
    end

    after do
      VCR.eject_cassette
    end

    it "should verify credentials successfully" do
      ZeroPush.verify_credentials.must_equal true
    end

    it "should fail to verify credentials" do
      ZeroPush.auth_token = "not a valid token"
      ZeroPush.verify_credentials.must_equal false
    end
  end

  describe "/notify" do
    before do
      VCR.insert_cassette "notify"
    end

    after do
      VCR.eject_cassette
    end

    it "should construct the request" do
      response = ZeroPush.notify(device_tokens: ['abc'], alert: 'hi')
      response.status.must_equal 200
    end
  end

  describe "/register" do
    before do
      VCR.insert_cassette "register"
    end

    after do
      VCR.eject_cassette
    end

    it "should register the device" do
      response = ZeroPush.register('abc')
      response.status.must_equal 200
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zero_push-1.1.0 spec/zero_push_spec.rb