Sha256: beacd9bdb5c61d0030c33e62c6fd56042b8fd962b88d422f00b6ff4a95de3185

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Mina::Helpers::Output do
  let(:dummy_class) { Class.new { include Mina::Helpers::Output } }
  let(:helper) { dummy_class.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 normally when the message is formatted by assets precompile' do
      expect { helper.print_stderr('I, [ ls -al') }.to output("       I, [ ls -al\n").to_stdout
    end

    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

1 entries across 1 versions & 1 rubygems

Version Path
mina-1.2.5 spec/lib/mina/helpers/output_spec.rb