Sha256: 1d4139f22d36d8d4ef38517d059d70fd7dfd3ade5e66ca3cbc8c1ac2ce36edcf

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe WhippedCream::Plugin do
  subject(:plugin) { described_class.new }

  its(:camera) { should be_nil }
  its(:name) { should be_nil }

  its(:controls) { should be_empty }

  its(:buttons) { should be_empty }
  its(:fields) { should be_empty }
  its(:sensors) { should be_empty }
  its(:switches) { should be_empty }

  describe ".build" do
    it "delegates to Builder" do
      block = -> {}
      expect(WhippedCream::Builder).to receive(:build).with(&block)
      described_class.build(&block)
    end
  end

  describe ".from_file" do
    it "delegates to Builder" do
      path = "foo/bar"
      expect(WhippedCream::Builder).to receive(:from_file).with(path)
      described_class.from_file(path)
    end
  end

  describe ".from_string" do
    it "delegates to Builder" do
      string = "name 'Garage'"
      expect(WhippedCream::Builder).to receive(:from_string).with(string)
      described_class.from_string(string)
    end
  end

  context "with a button" do
    before do
      plugin.controls << WhippedCream::Button.new("Open/Close", pin: 4)
    end

    its(:controls) { should_not be_empty }
    its(:buttons) { should_not be_empty }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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