Sha256: 89afd1abcb5c315b3398f4402122793566a921770e0e1b241d2801169d000082

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

require 'spec_helper'
require production_code

describe Milight::Brightness do
  describe '#to_milight_brightness' do
    {
      100 => 27,
      75  => 20,
      50  => 14,
      25  => 8,
      0   => 2
    }.each do |percent, milight|
      it "converts #{percent}% to the milight code #{milight}" do
        expect(described_class.new(percent).to_milight_brightness).to eq milight
      end
    end

    it 'raises an exception for invalid numbers' do
      expect { described_class.new(101) }.to raise_error ArgumentError
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
milight-easybulb-1.0.0 spec/milight/brightness_spec.rb