Sha256: a7a7d31fabe2099976fd5a4ee8c4f3b10485ddc743befb855aa77a66f0ed45b0
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
require 'unit_spec_helper' describe Rpush::Client::ActiveRecord::App do it 'validates the uniqueness of name within type and environment' do Rpush::Client::ActiveRecord::Apns::App.create!(name: 'test', environment: 'production', certificate: TEST_CERT) app = Rpush::Client::ActiveRecord::Apns::App.new(name: 'test', environment: 'production', certificate: TEST_CERT) expect(app.valid?).to eq(false) expect(app.errors[:name]).to eq ['has already been taken'] app = Rpush::Client::ActiveRecord::Apns::App.new(name: 'test', environment: 'development', certificate: TEST_CERT) expect(app.valid?).to eq(true) app = Rpush::Client::ActiveRecord::Gcm::App.new(name: 'test', environment: 'production', auth_key: TEST_CERT) expect(app.valid?).to eq(true) end context 'validating certificates' do it 'rescues from certificate error' do app = Rpush::Client::ActiveRecord::Apns::App.new(name: 'test', environment: 'development', certificate: 'bad') expect { app.valid? }.not_to raise_error expect(app.valid?).to eq(false) end it 'raises other errors' do app = Rpush::Client::ActiveRecord::Apns::App.new(name: 'test', environment: 'development', certificate: 'bad') allow(OpenSSL::X509::Certificate).to receive(:new).and_raise(NameError, 'simulating no openssl') expect { app.valid? }.to raise_error(NameError) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rpush-2.3.2-java | spec/unit/client/active_record/app_spec.rb |
rpush-2.3.2 | spec/unit/client/active_record/app_spec.rb |