Sha256: 3ed962472c94116ad0e86243b2d6270f3700eadf419d5b439ba41d967f9be79e

Contents?: true

Size: 825 Bytes

Versions: 1

Compression:

Stored size: 825 Bytes

Contents

require_relative '../lib/linepipe'
require 'minitest/autorun'

class DevelopTest < MiniTest::Unit::TestCase
  def linepipe
    @linepipe ||= Linepipe.develop do
      data {
        %w(foo bar baz)
      }

      step("Upcasing") { |data|
        data.map(&:upcase)
      }.expect('is upcased') { |data|
        data.first.upcase == data.first
      }

      step("Reversing") { |data|
        data.reverse
      }

      step("Sorting") { |data|
        data.sort
      }

      expect { |data|
        data == %w(BAR BAZ FOO)
      }
    end
  end

  def test_upcasing
    assert_equal %w(A B), linepipe['Upcasing'].apply(%w(a b))
  end

  def test_reversing
    assert_equal %w(b a), linepipe['Reversing'].apply(%w(a b))
  end

  def test_sorting
    assert_equal %w(a b c), linepipe['Sorting'].apply(%w(c a b))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linepipe-0.2.0 examples/develop.rb