ten_hs_server 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,11 +41,11 @@ module TenHsServer
41
41
 
42
42
  # Properties
43
43
  def on?
44
- true ? query[:status] == 2 : false
44
+ query[:status] == 2 ? true : false
45
45
  end
46
46
 
47
47
  def off?
48
- true ? query[:status] == 3 : false
48
+ query[:status] == 3 ? true : false
49
49
  end
50
50
 
51
51
  def type
@@ -65,10 +65,10 @@ module TenHsServer
65
65
  devices_in_room << device
66
66
  end
67
67
  end
68
-
68
+
69
69
  {
70
70
  name: name,
71
- floor: devices_in_room[0].floor,
71
+ floor: devices_in_room.any? ? devices_in_room[0].floor : nil,
72
72
  devices: devices_in_room
73
73
  }
74
74
 
@@ -1,3 +1,3 @@
1
1
  module TenHsServer
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -27,6 +27,17 @@ class RoomTest < ActiveSupport::TestCase
27
27
  assert_equal 2, room.devices.count
28
28
  end
29
29
 
30
+ test "should try to load a room with no devices or an unexisting room" do
31
+ TenHsServer::Device.expects(:get).with(
32
+ "?t=99&f=GetDevices",
33
+ ).returns(
34
+ stub body: fixture("devices_result.html")
35
+ )
36
+
37
+ room = TenHsServer::Room.new "Foobar"
38
+ assert_equal nil, room.floor
39
+ end
40
+
30
41
  test "should turn on everything in a room" do
31
42
  TenHsServer::Device.expects(:get).with(
32
43
  "?t=99&f=GetDevices",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ten_hs_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
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: 2012-12-19 00:00:00.000000000 Z
12
+ date: 2012-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -140,7 +140,6 @@ files:
140
140
  - lib/ten_hs_server/adapter.rb
141
141
  - lib/ten_hs_server/device.rb
142
142
  - lib/ten_hs_server/event.rb
143
- - lib/ten_hs_server/floor.rb
144
143
  - lib/ten_hs_server/room.rb
145
144
  - lib/ten_hs_server/version.rb
146
145
  - ten_hs_server.gemspec
File without changes