Sha256: e994384b2963022d0a2b43934e2e4020903530ad0e145829cd99174d49ae014a

Contents?: true

Size: 770 Bytes

Versions: 12

Compression:

Stored size: 770 Bytes

Contents

require 'spec_helper'

describe DeviceCloud::PushNotification::AlertNotification 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::AlertNotification.new file_data }

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
device_cloud-0.2.4 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.2.3 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.2.2 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.2.1 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.2.0 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.1.0 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.0.11 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.0.10 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.0.9 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.0.8 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.0.7 spec/device_cloud/push_notification/alert_notification_spec.rb
device_cloud-0.0.6 spec/device_cloud/push_notification/alert_notification_spec.rb