Sha256: bdd1e7d2e4d45e33b6cc138bb7d87479dff82ebaae26c60778ad408912e7a164

Contents?: true

Size: 847 Bytes

Versions: 2

Compression:

Stored size: 847 Bytes

Contents

require 'rspec'
require 'linepipe'
require 'stringio'

module Linepipe
  describe Expectation, '#successful?' do
    let(:io) { StringIO.new }

    describe 'when it fails' do
      let(:expectation) do
        Expectation.new('Failure message', io) { false }
      end

      it 'prints the message to the output' do
        expectation.successful?(%w(some data))
        expect(io.string).to match(/expectation_spec/)
        expect(io.string).to match(/Failure message/)
      end

      it 'returns false' do
        expect(expectation.successful?(%w(some data))).to be_false
      end
    end

    describe 'when it passes' do
      let(:expectation) do
        Expectation.new('Failure message', io) { true }
      end

      it 'returns true' do
        expect(expectation.successful?(%w(some data))).to be_true
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
linepipe-0.1.1 spec/pipeline/expectation_spec.rb
linepipe-0.1.0 spec/pipeline/expectation_spec.rb