Sha256: 9aa5eb8b8ee02121c319a0478df5cce5a089090b858df9a714c1389256c4b3ba

Contents?: true

Size: 907 Bytes

Versions: 1

Compression:

Stored size: 907 Bytes

Contents

require 'minitest/autorun'
require 'rodimus'

module Rodimus
  Rodimus.configure do |config|
    config.logger = Logger.new(nil)
  end
  
  class TestStep < MiniTest::Unit::TestCase
    def setup
      @test_string = "row 1\nrow 2"
      @incoming = StringIO.new(@test_string)
      @outgoing = StringIO.new
    end

    def test_streaming_rows
      step = Object.new
      step.extend(Rodimus::Step)
      step.incoming = @incoming
      step.outgoing = @outgoing
      step.run
      @outgoing.rewind
      assert_equal @test_string, @outgoing.read.chomp
    end

    def test_process_row
      step = Class.new do
        include Rodimus::Step

        def process_row(row)
          row.upcase
        end
      end.new
      step.incoming = @incoming
      step.outgoing = @outgoing
      step.run
      @outgoing.rewind
      assert_equal @test_string.upcase, @outgoing.read.chomp
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rodimus-0.1.0 test/step_test.rb