diff --git a/test/remote/spec/state_spec.rb b/test/remote/spec/state_spec.rb index 8da7233b..0ac52676 100644 --- a/test/remote/spec/state_spec.rb +++ b/test/remote/spec/state_spec.rb @@ -105,4 +105,40 @@ # expect(patched_state.select { |x| desired_state.include?(x) } ).to eq(desired_state) # end end + + context 'fields' do + it 'should support the color field' do + desired_state = { + 'hue' => 0, + 'saturation' => 100, + 'status' => 'ON' + } + + @client.patch_state( + desired_state.merge(hue: 100), + @id_params + ) + + @client.patch_state( + { color: '255,0,0' }, + @id_params + ) + + state = @client.get_state(@id_params) + + expect(state.keys).to include(*desired_state.keys) + expect(state.select { |x| desired_state.include?(x) } ).to eq(desired_state) + + @client.patch_state( + { color: {r: 0, g: 255, b: 0} }, + @id_params + ) + state = @client.get_state(@id_params) + + desired_state.merge!('hue' => 120) + + expect(state.keys).to include(*desired_state.keys) + expect(state.select { |x| desired_state.include?(x) } ).to eq(desired_state) + end + end end \ No newline at end of file