spec/acceptance/rest/push_admin_spec.rb in ably-1.2.4 vs spec/acceptance/rest/push_admin_spec.rb in ably-1.2.6
- old
+ new
@@ -179,11 +179,11 @@
platform: 'ios',
form_factor: 'phone',
client_id: client_id,
push: {
recipient: {
- transport_type: 'gcm',
+ transport_type: 'fcm',
registration_token: 'secret_token',
}
}
})
end
@@ -248,11 +248,11 @@
platform: 'ios',
form_factor: 'phone',
client_id: client_id,
push: {
recipient: {
- transport_type: 'gcm',
+ transport_type: 'fcm',
registration_token: 'secret_token',
}
}
})
end
@@ -266,19 +266,19 @@
it 'returns a DeviceDetails object if a device ID string is provided' do
device = subject.get("device-#{client_id}-0")
expect(device).to be_a(Ably::Models::DeviceDetails)
expect(device.platform).to eql('ios')
expect(device.client_id).to eql(client_id)
- expect(device.push.recipient.fetch(:transport_type)).to eql('gcm')
+ expect(device.push.recipient.fetch(:transport_type)).to eql('fcm')
end
it 'returns a DeviceDetails object if a DeviceDetails object is provided' do
device = subject.get(Ably::Models::DeviceDetails.new(id: "device-#{client_id}-1"))
expect(device).to be_a(Ably::Models::DeviceDetails)
expect(device.platform).to eql('ios')
expect(device.client_id).to eql(client_id)
- expect(device.push.recipient.fetch(:transport_type)).to eql('gcm')
+ expect(device.push.recipient.fetch(:transport_type)).to eql('fcm')
end
it 'raises a ResourceMissing exception if device ID does not exist' do
expect { subject.get("device-does-not-exist") }.to raise_error(Ably::Exceptions::ResourceMissing)
end
@@ -348,50 +348,55 @@
expect(device_retrieved.push.recipient.fetch(:transport_type)).to eql('apns')
expect(device_retrieved.push.recipient['deviceToken']).to eql(transport_token)
expect(device_retrieved.push.recipient['foo_bar']).to eql('string')
end
- context 'with GCM target' do
+ context 'with FCM target' do
let(:device_token) { random_str }
it 'saves the associated DevicePushDetails' do
subject.save(device_details.merge(
push: {
recipient: {
- transport_type: 'gcm',
+ transport_type: 'fcm',
registrationToken: device_token
}
}
))
device_retrieved = subject.get(device_details.fetch(:id))
- expect(device_retrieved.push.recipient.fetch('transportType')).to eql('gcm')
+ expect(device_retrieved.push.recipient.fetch('transportType')).to eql('fcm')
expect(device_retrieved.push.recipient[:registration_token]).to eql(device_token)
end
end
context 'with web target' do
let(:target_url) { 'http://foo.com/bar' }
- let(:encryption_key) { random_str }
+ let(:p256dh) { random_str }
+ let(:auth) { random_str }
it 'saves the associated DevicePushDetails' do
subject.save(device_details.merge(
push: {
recipient: {
transport_type: 'web',
targetUrl: target_url,
- encryptionKey: encryption_key
+ encryptionKey: {
+ p256dh: p256dh,
+ auth: auth
+ }
}
}
))
device_retrieved = subject.get(device_details.fetch(:id))
expect(device_retrieved.push.recipient[:transport_type]).to eql('web')
expect(device_retrieved.push.recipient['targetUrl']).to eql(target_url)
- expect(device_retrieved.push.recipient['encryptionKey']).to eql(encryption_key)
+ expect(device_retrieved.push.recipient['encryptionKey']['p256dh']).to eql(p256dh)
+ expect(device_retrieved.push.recipient['encryptionKey']['auth']).to eql(auth)
end
end
it 'does not allow some fields to be configured' do
subject.save(device_details)
@@ -460,11 +465,11 @@
platform: 'ios',
form_factor: 'phone',
client_id: client_id,
push: {
recipient: {
- transport_type: 'gcm',
+ transport_type: 'fcm',
registrationToken: 'secret_token',
}
}
})
end,
@@ -474,11 +479,11 @@
platform: 'ios',
form_factor: 'phone',
client_id: client_id,
push: {
recipient: {
- transport_type: 'gcm',
+ transport_type: 'fcm',
registration_token: 'secret_token',
}
}
})
end
@@ -523,11 +528,11 @@
platform: 'ios',
form_factor: 'phone',
client_id: client_id,
push: {
recipient: {
- transport_type: 'gcm',
+ transport_type: 'fcm',
registration_token: 'secret_token',
}
}
})
end,
@@ -537,11 +542,11 @@
platform: 'ios',
form_factor: 'phone',
client_id: client_id,
push: {
recipient: {
- transport_type: 'gcm',
+ transport_type: 'fcm',
registration_token: 'secret_token',
}
}
})
end
@@ -578,10 +583,10 @@
platform: 'ios',
form_factor: 'phone',
client_id: client_id,
push: {
recipient: {
- transport_type: 'gcm',
+ transport_type: 'fcm',
registration_token: 'secret_token',
}
}
}
}