Sha256: 3f1dddcd38a9864f5b6369c7bfb9e6aa9039f6aab4e4c8d6fbc7d7569ad65ea9

Contents?: true

Size: 756 Bytes

Versions: 5

Compression:

Stored size: 756 Bytes

Contents

require 'spec_helper'

describe DeviceCloud::PushNotification::Alert do
  describe "#handle!" do
    let(:data) do
      {
        'id' => 1234,
        'device_id' => 'm:1392301029',
        'type' => 'some type',
        'queued_dt' => '2013-06-24T14:52:55.421Z',
        'value' => {'this' => 'is a value'}
      }
    end
    let(:file_data) { OpenStruct.new(data: data, full_path: '/foo/bar/baz.json') }

    subject { DeviceCloud::PushNotification::Alert.new file_data }

    it "should call the DeviceCloud.push_notification_alert_handler with self" do
      handled_alert = nil
      DeviceCloud.push_notification_alert_handler = ->(alert) { handled_alert = alert }

      subject.handle!
      expect(handled_alert).to eq subject
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
device_cloud-0.0.5 spec/device_cloud/push_notification/alert_spec.rb
device_cloud-0.0.4 spec/device_cloud/push_notification/alert_spec.rb
device_cloud-0.0.3 spec/device_cloud/push_notification/alert_spec.rb
device_cloud-0.0.2 spec/device_cloud/push_notification/alert_spec.rb
device_cloud-0.0.1 spec/device_cloud/push_notification/alert_spec.rb