test/resque_aps_test.rb in resque-aps-0.9.8 vs test/resque_aps_test.rb in resque-aps-0.9.9

- old
+ new

@@ -1,8 +1,8 @@ require File.dirname(__FILE__) + '/test_helper' -context "ResqueAps" do +context "Resque::Plugins::Aps" do setup do Resque.redis.flushall end # test "needs to infer a queue with enqueue" do @@ -41,41 +41,41 @@ assert Resque.create_aps_application('SomeApp2', '/var/apps/certificates/someapp2.pem', 'secret') assert_equal ['SomeApp2', 'SomeApp'], Resque.aps_application_names(0, 2) end test "can enqueue aps notifications" do - n = ResqueAps::Notification.new('application_name' => 'SomeApp', 'device_token' => 'aihdf08u2402hbdfquhiwr', 'payload' => '{"aps": { "alert": "hello"}}') + n = Resque::Plugins::Aps::Notification.new('application_name' => 'SomeApp', 'device_token' => 'aihdf08u2402hbdfquhiwr', 'payload' => '{"aps": { "alert": "hello"}}') assert Resque.enqueue_aps('SomeApp', n) assert_equal 1, Resque.aps_notification_count_for_application('SomeApp') assert Resque.enqueue_aps('SomeApp', n) assert_equal 2, Resque.aps_notification_count_for_application('SomeApp') end test "can dequeue aps notifications" do - n = ResqueAps::Notification.new('application_name' => 'SomeApp', 'device_token' => 'aihdf08u2402hbdfquhiwr', 'payload' => '{"aps": { "alert": "hello"}}') + n = Resque::Plugins::Aps::Notification.new('application_name' => 'SomeApp', 'device_token' => 'aihdf08u2402hbdfquhiwr', 'payload' => '{"aps": { "alert": "hello"}}') assert Resque.enqueue_aps('SomeApp', n) assert_equal 1, Resque.aps_notification_count_for_application('SomeApp') nn = Resque.dequeue_aps('SomeApp') assert nn - assert_kind_of ResqueAps::Notification, nn + assert_kind_of Resque::Plugins::Aps::Notification, nn assert_equal n.application_name, nn.application_name assert_equal n.device_token, nn.device_token assert_equal n.payload, nn.payload end test "knows how big the application notification queue is" do - n = ResqueAps::Notification.new('application_name' => 'SomeApp', 'device_token' => 'aihdf08u2402hbdfquhiwr', 'payload' => '{"aps": { "alert": "hello"}}') + n = Resque::Plugins::Aps::Notification.new('application_name' => 'SomeApp', 'device_token' => 'aihdf08u2402hbdfquhiwr', 'payload' => '{"aps": { "alert": "hello"}}') assert Resque.enqueue_aps('SomeApp', n) assert_equal 1, Resque.aps_notification_count_for_application('SomeApp') assert Resque.enqueue_aps('SomeApp', n) assert_equal 2, Resque.aps_notification_count_for_application('SomeApp') end test "can get a list of application notifications" do - n = ResqueAps::Notification.new('application_name' => 'SomeApp', 'device_token' => 'aihdf08u2402hbdfquhiwr', 'payload' => '{"aps": { "alert": "hello"}}') + n = Resque::Plugins::Aps::Notification.new('application_name' => 'SomeApp', 'device_token' => 'aihdf08u2402hbdfquhiwr', 'payload' => '{"aps": { "alert": "hello"}}') assert Resque.enqueue_aps('SomeApp', n) assert Resque.enqueue_aps('SomeApp', n) assert Resque.enqueue_aps('SomeApp', n) assert_equal 3, Resque.aps_notification_count_for_application('SomeApp') a = Resque.aps_notifications_for_application('SomeApp', 0, 20)