Sha256: 7ab8dfa94a8aadf26d95ad7adedf5cb2c07eb2412e2eb2758326ab41c7f8638d

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe SPNet::BlockState do
  describe '.new' do
    it 'should assign block class' do
      block_state = BlockState.new :class_sym => :TestBlock
      block_state.class_sym.should eq(:TestBlock)
    end
    
    it 'should assign port params' do
      params = {
        "VALUE1" => 0.0,
        "VALUE2" => 1.0,
      }
      block_state = BlockState.new :class_sym => :TestBlock, :params => params
      block_state.params.should eq(params)
    end
  end
  
  describe '#make_block' do
    before :all do
      @params = {
        "VALUE1" => 0.1,
        "VALUE2" => 0.9,
      }
      @class_sym = :TestBlock
      block_state = BlockState.new :class_sym => @class_sym, :params => @params
      @block = block_state.make_block :sample_rate => 2
    end
    
    it 'should make a block of the given class type' do
      @block.class.to_s.to_sym.should eq(@class_sym)
    end

    it 'should make a block using given port params' do
      @block.value1.should eq(@params["VALUE1"])
      @block.value2.should eq(@params["VALUE2"])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spnet-0.1.8 spec/storage/block_state_spec.rb
spnet-0.1.7 spec/storage/block_state_spec.rb
spnet-0.1.6 spec/storage/block_state_spec.rb