Sha256: 2789e9cb89a122b867d04f4e4d426cbc4ce31395e84e5529dc5539a96c0e130b

Contents?: true

Size: 909 Bytes

Versions: 18

Compression:

Stored size: 909 Bytes

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
      expect{ helper.print_line('ls -al') }.to output("       ls -al\n").to_stdout
    end

    it 'prints comment' do
      expect{ helper.print_line('-> ls -al') }.to output("\e[32m----->\e[0m ls -al\n").to_stdout
    end

    it 'prints error' do
      expect{ helper.print_line('! ls -al') }.to output(" \e[33m!\e[0m     \e[31mls -al\e[0m\n").to_stdout
    end

    it 'prints command' do
      expect{ helper.print_line('$ ls -al') }.to output("       \e[36m$\e[0m \e[36mls -al\e[0m\n").to_stdout
    end
  end

  describe '#print_stderr' do
    it 'prints stderr' do
      expect{ helper.print_stderr('ls -al') }.to output("       \e[31mls -al\e[0m\n").to_stdout
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mina-1.2.4 spec/lib/mina/helpers/output_spec.rb
mina-1.2.3 spec/lib/mina/helpers/output_spec.rb
mina-1.2.2 spec/lib/mina/helpers/output_spec.rb
mina-1.2.1 spec/lib/mina/helpers/output_spec.rb
mina-1.2.0 spec/lib/mina/helpers/output_spec.rb
mina-1.1.1 spec/lib/mina/helpers/output_spec.rb
mina-1.1.0 spec/lib/mina/helpers/output_spec.rb
mina-1.0.7 spec/lib/mina/helpers/output_spec.rb
mina-1.0.6 spec/lib/mina/helpers/output_spec.rb
mina-1.0.5 spec/lib/mina/helpers/output_spec.rb
mina-1.0.4 spec/lib/mina/helpers/output_spec.rb
mina-1.0.3 spec/lib/mina/helpers/output_spec.rb
mina-1.0.2 spec/lib/mina/helpers/output_spec.rb
mina-1.0.0 spec/lib/mina/helpers/output_spec.rb
mina-1.0.0.rc2 spec/lib/mina/helpers/output_spec.rb
mina-1.0.0.beta5 spec/lib/mina/helpers/output_spec.rb
mina-1.0.0.beta4 spec/lib/mina/helpers/output_spec.rb
mina-1.0.0.beta3 spec/lib/mina/helpers/output_spec.rb