Sha256: f030995fd2c48ac1390741889164c14aa8abdec990a48ae942d7abc8eab7ebd1

Contents?: true

Size: 860 Bytes

Versions: 16

Compression:

Stored size: 860 Bytes

Contents

require 'spec_helper'
require 'grocer/failed_delivery_attempt'

describe Grocer::FailedDeliveryAttempt do
  let(:timestamp) { Time.utc(1995, 12, 21) }
  let(:device_token) { 'fe15a27d5df3c34778defb1f4f3980265cc52c0c047682223be59fb68500a9a2' }
  let(:binary_tuple) { [timestamp.to_i, 32, device_token].pack('NnH64') }
  let(:invalid_binary_tuple) { 'totally not the right format' }

  describe 'decoding' do
    it 'accepts a binary tuple and sets each attribute' do
      failed_delivery_attempt = described_class.new(binary_tuple)
      failed_delivery_attempt.timestamp.should == timestamp
      failed_delivery_attempt.device_token.should == device_token
    end

    it 'raises an exception when there are problems decoding' do
      -> { described_class.new(invalid_binary_tuple) }.should
        raise_error(Grocer::InvalidFormatError)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
grocer-0.2.0 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.1.1 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.1.0 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.13 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.12 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.11 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.10 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.9 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.8 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.7 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.6 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.5 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.4 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.3 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.2 spec/grocer/failed_delivery_attempt_spec.rb
grocer-0.0.1 spec/grocer/failed_delivery_attempt_spec.rb