Sha256: d1f99f90b630bca484b4b35bb9eca5ab1edb4e97c55fd0aa5b47500ac780f16b

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe Mina::Helpers::Output do
  class DummyOutputHelper
    include Mina::Helpers::Output
  end

  let(:helper) { DummyOutputHelper.new }

  describe '#print_line' do
    it 'prints normally' do
      out, _err = capture_io do
        helper.print_line('ls -al')
      end
      expect(out).to eq("       ls -al\n")
    end

    it 'prints comment' do
      out, _err = capture_io do
        helper.print_line('-> ls -al')
      end
      expect(out).to eq("\e[32m----->\e[0m ls -al\n")
    end

    it 'prints error' do
      out, _err = capture_io do
        helper.print_line('! ls -al')
      end
      expect(out).to eq(" \e[33m!\e[0m     \e[31mls -al\e[0m\n")
    end

    it 'prints command' do
      out, _err = capture_io do
        helper.print_line('$ ls -al')
      end
      expect(out).to eq("       \e[36m$\e[0m \e[36mls -al\e[0m\n")
    end
  end

  describe '#print_stderr' do
    it 'prints stderr' do
      out, _err = capture_io do
        helper.print_stderr('ls -al')
      end
      expect(out).to eq("       \e[31mls -al\e[0m\n")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mina-1.0.0.beta2 spec/lib/mina/helpers/output_spec.rb
mina-1.0.0.beta1 spec/lib/mina/helpers/output_spec.rb