Permalink
Browse files

calculate boundary between binary and payload

  • Loading branch information...
1 parent ccf77c3 commit f0699bd143c77fc15b6a2b53c9421805fbefdcfe @niku committed Apr 16, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 spec/apn_on_rails/app/models/apn/notification_spec.rb
View
4 spec/apn_on_rails/app/models/apn/notification_spec.rb
@@ -50,6 +50,10 @@
noty.message_for_sending
}
let(:token) { '5gxadhy6 6zmtxfl6 5zpbcxmw ez3w7ksf qscpr55t trknkzap 7yyt45sc g6jrw7qz' }
+ let(:device_token_binary_size) { [token.delete(' ')].pack('H*').size }
+ let(:token_part_header_length) { 1 + 2 } # Command length(1 byte) + Token length(2 byte)
+ let(:payload_part_header_length) { 2 } # Payload length(2 byte)
+ let(:boundaly_between_binary_and_payload) { token_part_header_length + device_token_binary_size + payload_part_header_length }
it do
subject.should == fixture_value('message_for_sending.bin')

0 comments on commit f0699bd

Please sign in to comment.