Sha256: ad4efae652adc6c6aacc88ef1edf78eccef52c0bdc30b3e09732b0fe4d06a5e1

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

RSpec.describe RapiroWrapper::Eyes do
  context 'constructor' do
    context 'without params' do
      context '@value' do
        subject { described_class.new.instance_variable_get :@value }
        it { is_expected.to eq '#000080' }
      end
    end
    context 'with "#123456"' do
      context '@value' do
        subject { described_class.new('#123456').instance_variable_get :@value }
        it { is_expected.to eq '#123456' }
      end
    end
    context 'with { red: 255, green: 128, blue: 0 }' do
      context '@value' do
        subject do
          described_class.new(red: 255, green: 128, blue: 0)
            .instance_variable_get :@value
        end
        it { is_expected.to eq '#ff8000' }
      end
    end
  end

  context '#to_code' do
    context 'with @value = "#ff8000"' do
      subject { described_class.new('#ff8000').to_code }
      it { is_expected.to eq 'R255G128B000' }
    end
    context 'with @value = "#aabbcc"' do
      subject { described_class.new('#aabbcc').to_code }
      it { is_expected.to eq 'R170G187B204' }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapiro_wrapper-0.1.0 spec/rapiro_wrapper/led/eyes_spec.rb