Sha256: 54ef0b06f35942ae39e338324e84cc3239a0e1465df0f54501a2b16d51b83aec

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

require 'unit_spec_helper'

describe Rpush::Client::ActiveRecord::App do
  it 'does not validate an app with an invalid certificate' do
    app = Rpush::Client::ActiveRecord::Apns::App.new(name: 'test', environment: 'development', certificate: 'foo')
    app.valid?
    expect(app.errors[:certificate]).to eq ['value must contain a certificate and a private key.']
  end

  it 'validates a certificate without a password' do
    app = Rpush::Client::ActiveRecord::Apns::App.new name: 'test', environment: 'development', certificate: TEST_CERT
    app.valid?
    expect(app.errors[:certificate]).to eq []
  end

  it 'validates a certificate with a password' do
    app = Rpush::Client::ActiveRecord::Apns::App.new name: 'test', environment: 'development',
                                                     certificate: TEST_CERT_WITH_PASSWORD, password: 'fubar'
    app.valid?
    expect(app.errors[:certificate]).to eq []
  end

  it 'validates a certificate with an incorrect password' do
    app = Rpush::Client::ActiveRecord::Apns::App.new name: 'test', environment: 'development',
                                                     certificate: TEST_CERT_WITH_PASSWORD, password: 'incorrect'
    app.valid?
    expect(app.errors[:certificate]).to eq ['value must contain a certificate and a private key.']
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rpush-2.3.2-java spec/unit/client/active_record/apns/app_spec.rb
rpush-2.3.2 spec/unit/client/active_record/apns/app_spec.rb