Sha256: 66515f63b64e77cef872499afc9a732d34c6f392b77d2ba2affe130d63c11195

Contents?: true

Size: 830 Bytes

Versions: 2

Compression:

Stored size: 830 Bytes

Contents

require 'spec_helper'

describe DeviceCloud::PushNotification::DataNotification do
  let(:data) do
    {
      'id' => {
        'fdPath' => '/db/MadGlory/Meter/data/',
        'fdName' => 'foobar_1.jpg'
      },
      '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::DataNotification.new file_data }
  
  describe "#handle!" do

    it "should call the DeviceCloud.data_notification_handler with self" do
      handled_data = nil
      DeviceCloud.data_notification_handler = ->(data) { handled_data = data }

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
device_cloud-0.0.10 spec/device_cloud/push_notification/data_notification_spec.rb
device_cloud-0.0.9 spec/device_cloud/push_notification/data_notification_spec.rb