Sha256: 37eaa5fc900e2a9e7e7b14bf1bbfde1f3df7021504710a6c2ea5a95053466f1b
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' module LIFX describe Client, integration: true do describe '#sync' do let(:minimum_lights) { 3 } let(:udp) { Transport::UDP.new('0.0.0.0', 56_750) } let(:white) { Color.white(brightness: 0.5) } it 'schedules sending all messages to be executed at the same time' do if lights.count < minimum_lights pending 'This test requires 3 or more lights tagged under Test' return end lifx.discover! { lights.count >= minimum_lights } lights.set_color(white, duration: 0) sleep 1 msgs = [] udp.add_observer(self, :message_received) do |message: nil, ip: nil, transport: nil| msgs << message if message.payload.is_a?(Protocol::Light::SetWaveform) end udp.listen lifx.sync do lights.each do |light| light.pulse(LIFX::Color.hsb(rand(360), 1, 1), period: 1) end end expect(msgs.count).to eq lights.count expect(msgs.map(&:at_time).uniq.count).to eq 1 flush end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lifx-0.4.11 | spec/integration/client_spec.rb |
lifx-0.4.10 | spec/integration/client_spec.rb |
lifx-0.4.8 | spec/integration/client_spec.rb |