Sha256: e171419bfe984d2914a4878846b43546d9fa9f2f10bc160f902d9d9d1896663b

Contents?: true

Size: 975 Bytes

Versions: 2

Compression:

Stored size: 975 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(:message_connection) { RFlow::MessageCollectingConnection.new }

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

    let(:ruby_proc_filter) do
      RFlow::Components::RubyProcFilter.new.tap do |c|
        c.configure! 'filter_proc_string' => 'message % 2 == 0'
        c.filtered.add_connection nil, message_connection
      end
    end

    def messages; message_connection.messages; end

    it 'should place the messages on the output port, regardless of the filter' do
      5.times { generator.generate }
      expect(messages.map(&:data).map(&:data_object)).to eq([0, 1, 2, 3, 4])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rflow-1.0.0a4 spec/rflow/forward_to_output_port_spec.rb
rflow-1.0.0a3 spec/rflow/forward_to_output_port_spec.rb