Sha256: 6fc1a5830be25b2fc019edc58b9e7dcd91fd46871c0d0286157d81a9d42343a9

Contents?: true

Size: 770 Bytes

Versions: 12

Compression:

Stored size: 770 Bytes

Contents

require 'spec_helper'

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

    it "should call the DeviceCloud.event_notification_handler with self" do
      handled_event = nil
      DeviceCloud.event_notification_handler = ->(event) { handled_event = event }

      subject.handle!
      expect(handled_event).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/event_notification_spec.rb
device_cloud-0.2.3 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.2.2 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.2.1 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.2.0 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.1.0 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.0.11 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.0.10 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.0.9 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.0.8 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.0.7 spec/device_cloud/push_notification/event_notification_spec.rb
device_cloud-0.0.6 spec/device_cloud/push_notification/event_notification_spec.rb