Sha256: e6a7d720de847d230c03002582f061e899df29673b65d5bd144395bcb6fe40f7
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
require 'spec_helper' describe Notifiable::Apns::Grocer::Stream do let(:a) { Notifiable::App.create } let(:n1) { Notifiable::Notification.create(:message => "Test message", :app => a) } let(:n1_with_params) { Notifiable::Notification.create(:message => "Test message", :app => a, :params => {:flag => true}) } let(:d) { Notifiable::DeviceToken.create(:token => "ABC123", :provider => :apns, :app => a) } it "sends a single notification" do n1.batch do |n| n.add_device_token(d) end Notifiable::NotificationStatus.count.should == 1 Notifiable::NotificationStatus.first.status.should == 0 Timeout.timeout(2) { notification = @grocer.notifications.pop notification.alert.should eql "Test message" notification.custom[:notification_id].should == n1.id } end it "supports custom properties" do n1_with_params.batch do |n| n.add_device_token(d) end Notifiable::NotificationStatus.count.should == 1 Notifiable::NotificationStatus.first.status.should == 0 Timeout.timeout(2) { notification = @grocer.notifications.pop notification.custom[:notification_id].should == n1_with_params.id notification.custom[:flag].should == true } end it "can use production gateway" do g = Notifiable::Apns::Grocer::Stream.new(Rails.env, n1) a.configuration = {:apns => {:sandbox => "0"}} # This is how production is configured a.configure(:apns, g) expect(g.send(:sandbox?)).to be_falsey end it "has default connection pool size" do g = Notifiable::Apns::Grocer::Stream.new(Rails.env, n1) expect(g.send(:connection_pool_size)).to eq 10 end it "has default connection pool timeout" do g = Notifiable::Apns::Grocer::Stream.new(Rails.env, n1) expect(g.send(:connection_pool_timeout)).to eq 10 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
notifiable-apns-grocer-0.10.0 | spec/stream_spec.rb |