Sha256: e32f53f4e5c937c922d94b621af6bfa07b4a31fddff3063e52e27c89d13c4ebd

Contents?: true

Size: 561 Bytes

Versions: 2

Compression:

Stored size: 561 Bytes

Contents

require 'spec_helper'

describe WhippedCream::Switch do
  context 'valid switch' do
    subject(:switch) { described_class.new(name, pin: valid_pin) }

    let(:name) { "Light" }
    let(:valid_pin) { 18 }

    its(:name) { should eq(name) }
    its(:id) { should eq(:light) }
    its(:type) { should eq(:switch) }
    its(:pin) { should eq(18) }
  end

  context 'invalid switch' do
    let(:invalid_pin) { 3 }

    it 'should raise an error upon initialization' do
      expect { described_class.new(name, pin: invalid_pin) }.to raise_error
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whipped-cream-0.2.0.beta1 spec/lib/whipped-cream/switch_spec.rb
whipped-cream-0.1.1 spec/lib/whipped-cream/switch_spec.rb