Giter Club home page Giter Club logo

Comments (1)

lukasnagl avatar lukasnagl commented on May 26, 2024

I was just trying to test for feedback in light of issues such as #14. This issue labelled as enhancement seems to suggest that this should be possible. Here’s the rspec test snippet I came up with for this. I threw in the second expectation after I found #80 just to be sure.

require 'spec_helper'

describe 'grocer push notifications' do
  before(:each) do
    @server = Grocer.server(port: 2195)
    @server.accept # starts listening in background
  end

  after(:each) do
    @server.close
  end
  let(:notification) do
    Grocer::Notification.new(
      device_token:      "wrongtoken",
      alert:             "I should trigger feedback.",
      badge:             42
    )
  end
  let(:cert) { "#{Rails.root}/app/assets/push_notifications/apple_push_notification_dev.pem" }
  let!(:push_client) { Grocer.pusher(certificate: cert) }
  let!(:feedback_client) { Grocer.feedback(certificate: cert, retries: 3) }

  it 'should have feedback for an invalid notification' do
    push_client.push(notification)
    expect(feedback_client.count).not_to eq(0)
  end

  it 'should have feedback for an invalid notification with to_a fix' do
    push_client.push(notification)
    expect(feedback_client.to_a.count).not_to eq(0)
  end
end

from grocer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.