Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grocer::Server can send feedback #4

Open
alindeman opened this issue May 8, 2012 · 1 comment
Open

Grocer::Server can send feedback #4

alindeman opened this issue May 8, 2012 · 1 comment

Comments

@alindeman
Copy link
Member

No description provided.

@lukasnagl
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants