Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tboyko committed Mar 7, 2014
1 parent cb498a9 commit 3ae93fe
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions spec/notification_queue_spec.rb
Expand Up @@ -13,21 +13,30 @@
end

it 'should add notifications to the queue' do
expect_any_instance_of(Redis).to receive(:rpush)

n = generate_notification
@q.add(n)
end

it 'should count notification on the queue when they are there' do
@q.size.should_not eql(0)
expect_any_instance_of(Redis).to receive(:llen).and_return(1)

expect(@q.size).to be_a_kind_of(Integer)
end

it 'should get notifications from the queue' do
while n = @q.get
n.should be_an_instance_of(AppleShove::Notification)
end
json = { p12: 'some p12', device_token: '123123123', payload: 'this is a test payload' }.to_json
expect_any_instance_of(Redis).to receive(:lpop).and_return(json)

notification = @q.get

expect(notification).to be_an_instance_of(AppleShove::Notification)
end

it 'should count 0 notifications when the queue is empty' do
expect_any_instance_of(Redis).to receive(:llen).and_return(0)

@q.size.should eql(0)
end

Expand Down

0 comments on commit 3ae93fe

Please sign in to comment.