spec/acceptance/realtime/push_admin_spec.rb in ably-1.1.1 vs spec/acceptance/realtime/push_admin_spec.rb in ably-1.1.2
- old
+ new
@@ -215,10 +215,16 @@
describe '#list' do
let(:client_id) { random_str }
let(:fixture_count) { 6 }
+ before(:all) do
+ # As push tests often use the global scope (devices),
+ # we need to ensure tests cannot conflict
+ reload_test_app
+ end
+
before do
fixture_count.times.map do |index|
Thread.new do # Parallelise the setup
rest_device_registrations.save({
id: "device-#{client_id}-#{index}",
@@ -272,10 +278,16 @@
describe '#get' do
let(:fixture_count) { 2 }
let(:client_id) { random_str }
+ before(:all) do
+ # As push tests often use the global scope (devices),
+ # we need to ensure tests cannot conflict
+ reload_test_app
+ end
+
before do
fixture_count.times.map do |index|
Thread.new do # Parallelise the setup
rest_device_registrations.save({
id: "device-#{client_id}-#{index}",
@@ -351,10 +363,16 @@
},
}
}
end
+ before(:all) do
+ # As push tests often use the global scope (devices),
+ # we need to ensure tests cannot conflict
+ reload_test_app
+ end
+
after do
rest_device_registrations.remove_where client_id: client_id
end
it 'saves the new DeviceDetails Hash object' do
@@ -386,10 +404,16 @@
describe '#remove_where' do
let(:device_id) { random_str }
let(:client_id) { random_str }
+ before(:all) do
+ # As push tests often use the global scope (devices),
+ # we need to ensure tests cannot conflict
+ reload_test_app
+ end
+
before do
rest_device_registrations.save({
id: "device-#{client_id}-0",
platform: 'ios',
form_factor: 'phone',
@@ -419,10 +443,16 @@
describe '#remove' do
let(:device_id) { random_str }
let(:client_id) { random_str }
+ before(:all) do
+ # As push tests often use the global scope (devices),
+ # we need to ensure tests cannot conflict
+ reload_test_app
+ end
+
before do
rest_device_registrations.save({
id: "device-#{client_id}-0",
platform: 'ios',
form_factor: 'phone',
@@ -479,10 +509,16 @@
subject {
client.push.admin.channel_subscriptions
}
+ before(:all) do
+ # As push tests often use the global scope (devices),
+ # we need to ensure tests cannot conflict
+ reload_test_app
+ end
+
# Set up 2 devices with the same client_id
# and two device with the unique device_id and no client_id
before do
[
lambda { rest_device_registrations.save(default_device_attr.merge(id: device_id)) },
@@ -541,11 +577,13 @@
end
describe '#list_channels' do
let(:fixture_count) { 6 }
- before(:context) do
- reload_test_app # TODO: Review if necessary later, currently other tests may affect list_channels
+ before(:all) do
+ # As push tests often use the global scope (devices),
+ # we need to ensure tests cannot conflict
+ reload_test_app
end
before do
fixture_count.times.map do |index|
Thread.new do