Sha256: 9b76d006001b366403a29525ec1645a2ac420e02803bdab1f954b48ce0984378

Contents?: true

Size: 1.27 KB

Versions: 10

Compression:

Stored size: 1.27 KB

Contents

require "unit_spec_helper"

describe Rpush::Client::Redis::Apnsp8::Notification do
  after do
    Rpush::Apnsp8::App.all.select { |a| a.environment == "development" && a.apn_key == "1" }.each(&:destroy)
  end

  it_behaves_like "Rpush::Client::Apns::Notification"

  it "should validate the length of the binary conversion of the notification", :aggregate_failures do
    notification = described_class.new
    notification.app = Rpush::Apnsp8::App.create(apn_key: "1",
                                                 apn_key_id: "2",
                                                 name: 'test',
                                                 environment: 'development',
                                                 team_id: "3",
                                                 bundle_id: "4")
    notification.device_token = "a" * 108
    notification.alert = ""

    notification.alert << "a" until notification.payload.bytesize == 4096
    expect(notification.valid?).to be_truthy
    expect(notification.errors[:base]).to be_empty

    notification.alert << "a"
    expect(notification.valid?).to be_falsey
    expect(notification.errors[:base].include?("APN notification cannot be larger than 4096 bytes. Try condensing your alert and device attributes.")).to be_truthy
  end
end if redis?

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rpush-9.2.0 spec/unit/client/redis/apnsp8/notification_spec.rb
rpush-9.1.0 spec/unit/client/redis/apnsp8/notification_spec.rb
rpush-9.0.0 spec/unit/client/redis/apnsp8/notification_spec.rb
rpush-8.0.0 spec/unit/client/redis/apnsp8/notification_spec.rb
rpush-7.0.1 spec/unit/client/redis/apnsp8/notification_spec.rb
rpush-7.0.0 spec/unit/client/redis/apnsp8/notification_spec.rb
rpush-6.0.1 spec/unit/client/redis/apnsp8/notification_spec.rb
rpush-6.0.0 spec/unit/client/redis/apnsp8/notification_spec.rb
rpush-5.4.0 spec/unit/client/redis/apnsp8/notification_spec.rb
rpush-5.3.0 spec/unit/client/redis/apnsp8/notification_spec.rb