Sha256: 72c0f49eb7204ebd4ec4765a64fdf4e8bbc9b0e75f71dfc29ce2fde4cf11a455

Contents?: true

Size: 898 Bytes

Versions: 4

Compression:

Stored size: 898 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!({})
        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'
      end
    end

    it 'should place the messages on the output port, regardless of the filter' do
      ruby_proc_filter.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

4 entries across 4 versions & 1 rubygems

Version Path
rflow-1.0.1 spec/rflow/forward_to_output_port_spec.rb
rflow-1.0.0 spec/rflow/forward_to_output_port_spec.rb
rflow-1.0.0a6 spec/rflow/forward_to_output_port_spec.rb
rflow-1.0.0a5 spec/rflow/forward_to_output_port_spec.rb