Sha256: ecf4189e3c9b3180d0e44c84e7dce3d18d8d60da32ce651ada4dc62398f7037a

Contents?: true

Size: 982 Bytes

Versions: 4

Compression:

Stored size: 982 Bytes

Contents

require 'spec_helper'

module LIFX
  describe 'tags', integration: true do
    let(:color) { Color.hsb(rand(360), 0.3, 0.3) }

    specify 'Clearing, setting and using tags' do
      light.add_tag('Foo')
      expect(light.tags).to include('Foo')

      test_tag = lights.with_tag('Foo')
      test_tag.turn_on
      test_tag.set_color(color, duration: 0)
      flush
      sleep 1 # Set messages are scheduled 250ms if no at_time is set
              # It also returns the current light state rather than the
              # final state
      light.refresh
      wait { expect(light.color).to be_similar_to(color) }

      light.remove_tag('Foo')
      wait { expect(light.tags).not_to include('Foo') }
    end

    it 'deletes tags when no longer assigned to a light' do
      light.add_tag('TempTag')
      light.remove_tag('TempTag')
      expect(lifx.unused_tags).to include('TempTag')
      lifx.purge_unused_tags!
      expect(lifx.unused_tags).to be_empty
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lifx-0.4.10 spec/integration/tags_spec.rb
lifx-0.4.8 spec/integration/tags_spec.rb
lifx-0.4.7 spec/integration/tags_spec.rb
lifx-0.4.6.1 spec/integration/tags_spec.rb