Sha256: e342696dc53d81e538952a71cfface12a2d284adddfa78c4ea568c6791dfa357

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe Brewby::Application do
  before do
    @output = {
      pin: 1,
      pulse_range: 5000
    }

    Brewby::Application.any_instance.stub(:configure_view)
    @application = Brewby::Application.new adapter: :test, outputs: [@output], inputs: [{}, {hardware_id: '28-ba1c9d2e48'}]
  end
  
  it 'should have one output' do
    @application.outputs.size.should == 1
    @application.outputs.first.should be_instance_of Brewby::HeatingElement
    @application.outputs.first.adapter.should be_instance_of Brewby::Outputs::Test
  end

  it 'should have two inputs' do
    @application.inputs.size.should == 2
    @application.inputs.each do |input|
      input.should be_instance_of Brewby::Inputs::Test
    end
  end
  

  context 'adding steps' do
    before do
      @application.add_step :temp_control, mode: :auto, mode: :auto, target: 155.0, duration: 15
      @step = @application.steps.first
    end

    it 'creates a step object with passed configuration options' do
      @step.should be_instance_of Brewby::Steps::TempControl
    end

    it 'passes an input and an output to the step' do
      @step.input.should == @application.inputs.first
      @step.output.should == @application.outputs.first
    end

    it 'allows the step to specify the input/output objects to use' do
      @application.add_step :temp_control, mode: :auto, mode: :auto, target: 155.0, duration: 15, input: @application.inputs.last
      @step = @application.steps.last
      @step.input.should == @application.inputs.last
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brewby-0.1.1 spec/application_spec.rb
brewby-0.1.0 spec/application_spec.rb