Sha256: 44bab3e2961e945f951955aebb8d19cdf8b265b3c832b8403803008410227dd7

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

# Pull in the server test_helper from resque
require 'resque_aps/server/test_helper.rb'

context "on GET to /aps" do
  setup { get "/aps" }

  should_respond_with_success
end

context "on GET to /aps with applications" do
  setup do 
    Resque.redis.flushall
    Resque.create_aps_application(:some_ivar_application, nil, nil)
    Resque.create_aps_application(:someother_ivar_application, nil, nil)
    get "/aps"
  end

  should_respond_with_success

  test 'see the applications' do
    assert last_response.body.include?('some_ivar_application')
    assert last_response.body.include?('someother_ivar_application')
  end
end

context "on GET to /aps/some_ivar_application" do
  setup do
    Resque.redis.flushall
    Resque.create_aps_application(:some_ivar_application, nil, nil)
    n = ResqueAps::Notification.new('application_name' => 'some_ivar_application', 'device_token' => 'aihdf08u2402hbdfquhiwr', 'payload' => '{"aps": { "alert": "hello"}}')
    assert Resque.enqueue_aps(:some_ivar_application, n)
    assert Resque.enqueue_aps(:some_ivar_application, n)
    assert Resque.enqueue_aps(:some_ivar_application, n)
    assert Resque.enqueue_aps(:some_ivar_application, n)
    get "/aps/some_ivar_application"
  end

  should_respond_with_success

  test 'see the applications' do
    assert last_response.body.include?('some_ivar_application')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
resque-aps-0.9.8 test/resque-web_test.rb
resque-aps-0.9.7 test/resque-web_test.rb
resque-aps-0.9.6 test/resque-web_test.rb
resque-aps-0.9.5 test/resque-web_test.rb
resque-aps-0.9.4 test/resque-web_test.rb
resque-aps-0.9.3 test/resque-web_test.rb
resque-aps-0.9.2 test/resque-web_test.rb