device_cloud 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
data/lib/device_cloud/version.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe DeviceCloud::PushNotification::DataNotification do
|
4
|
-
|
5
|
-
|
6
|
-
{
|
7
|
-
'
|
8
|
-
'
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
4
|
+
let(:data) do
|
5
|
+
{
|
6
|
+
'id' => {
|
7
|
+
'fdPath' => '/db/MadGlory/Meter/data/',
|
8
|
+
'fdName' => 'foobar_1.jpg'
|
9
|
+
},
|
10
|
+
'device_id' => 'm:1392301029',
|
11
|
+
'type' => 'some type',
|
12
|
+
'queued_dt' => '2013-06-24T14:52:55.421Z',
|
13
|
+
'value' => {'this' => 'is a value'}
|
14
|
+
}
|
15
|
+
end
|
16
|
+
let(:file_data) { OpenStruct.new(data: data, full_path: '/foo/bar/baz.json') }
|
15
17
|
|
16
|
-
|
18
|
+
subject { DeviceCloud::PushNotification::DataNotification.new file_data }
|
19
|
+
|
20
|
+
describe "#handle!" do
|
17
21
|
|
18
22
|
it "should call the DeviceCloud.data_notification_handler with self" do
|
19
23
|
handled_data = nil
|
@@ -23,4 +27,17 @@ describe DeviceCloud::PushNotification::DataNotification do
|
|
23
27
|
expect(handled_data).to eq subject
|
24
28
|
end
|
25
29
|
end
|
30
|
+
|
31
|
+
describe "#file_name" do
|
32
|
+
context 'when id is present' do
|
33
|
+
its(:file_name) { should eq data['id']['fdName']}
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'when id is nil' do
|
37
|
+
before(:each) do
|
38
|
+
data['id'] = nil
|
39
|
+
end
|
40
|
+
its(:file_name) { should eq '' }
|
41
|
+
end
|
42
|
+
end
|
26
43
|
end
|
data/spec/version_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: device_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|