Sha256: 55c924c4d39e0f4c671767c29c458ba56c255f4d01f7a62ecf05a0c033044dc1

Contents?: true

Size: 893 Bytes

Versions: 6

Compression:

Stored size: 893 Bytes

Contents

require 'spec_helper'

class RFlow
  describe ForwardToOutputPort do
    before(:each) do
      ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
      Configuration.migrate_database
    end

    let(:messages) { [] }

    let(:generator) do
      RFlow::Components::GenerateIntegerSequence.new.tap do |c|
        c.configure!({})
      end
    end

    let(:accept_evens) do
      RFlow::Components::RubyProcFilter.new.tap do |c|
        c.configure! 'filter_proc_string' => 'message % 2 == 0'
      end
    end

    it 'should place the messages on the output port, regardless of the filter' do
      generator.out.direct_connect accept_evens.filtered

      accept_evens.filtered.collect_messages(nil, messages) do
        5.times { generator.generate }
      end
      expect(messages.map(&:data).map(&:data_object)).to eq([0, 1, 2, 3, 4])
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rflow-1.3.2 spec/rflow/forward_to_output_port_spec.rb
rflow-1.3.1 spec/rflow/forward_to_output_port_spec.rb
rflow-1.3.0 spec/rflow/forward_to_output_port_spec.rb
rflow-1.3.0a1 spec/rflow/forward_to_output_port_spec.rb
rflow-1.2.0 spec/rflow/forward_to_output_port_spec.rb
rflow-1.1.0 spec/rflow/forward_to_output_port_spec.rb