Sha256: 217579e25f469047518434dc2d463c9d9d26576b6486d3505ae8824a77bd5b34

Contents?: true

Size: 942 Bytes

Versions: 1

Compression:

Stored size: 942 Bytes

Contents

require 'rspec'
require 'linepipe'

module Linepipe
  describe Step, '#apply' do
    let(:step) { Step.new('upcase', &:upcase) }

    it 'exposes a name' do
      expect(step.name).to eq('upcase')
    end

    describe '#apply' do
      it 'calls the block with the data' do
        expect(step.apply('data')).to eq('DATA')
      end
    end

    describe '#verify_expectations' do
      context 'when there are no expectations' do
        it 'returns an empty array' do
          expect(step.verify_expectations('DATA')).to eq([])
        end
      end

      it 'returns the expectations with their status' do
        step.expect('is upcased') { |data| data.upcase == data }
        step.expect('is downcased') { |data| data.downcase == data }
        expectations = step.verify_expectations('DATA')
        expect(expectations.first.status).to eq('pass')
        expect(expectations.last.status).to eq('fail')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linepipe-0.2.0 spec/pipeline/step_spec.rb