Sha256: de09ec3777ec3b353a319b4e147aff43d23a8020df5f29e0b0fb0ce4a9f79fc3

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

require 'readline'
require 'test_helper'
require File.join(File.dirname(__FILE__), '..', 'lib/sifttter_redux/cli_message.rb')

class CLIMessageTest < Test::Unit::TestCase
  def setup
    SifttterRedux::CLIMessage::deactivate_logging
  end
  
  def test_error_message
    assert_output('# test'.red + "\n") { SifttterRedux::CLIMessage::error('test') }
  end

  def test_info_message
    assert_output('# test'.blue + "\n") { SifttterRedux::CLIMessage::info('test') }
  end

  def test_info_block_single_line
    assert_output("# start".blue + "body\n" + 'end'.blue + "\n") do
      SifttterRedux::CLIMessage::info_block('start', 'end') { puts 'body' }
    end
  end

  def test_info_block_multiline
    assert_output("# start".blue + "\nbody\n" + '# end'.blue + "\n") do
      SifttterRedux::CLIMessage::info_block('start', 'end', true) { puts 'body' }
    end
  end
  
  def test_info_block_no_block
    assert_raise ArgumentError do
      SifttterRedux::CLIMessage::info_block('start', 'end', true)
    end
  end

  def test_section_message
    assert_output('---> test'.purple + "\n") { SifttterRedux::CLIMessage::section('test') }
  end

  def test_section_block_single_line
    assert_output("---> section".purple + "\nbody\n") do
      SifttterRedux::CLIMessage::section_block('section', true) { puts 'body' }
    end
  end

  def test_success_message
    assert_output('# test'.green + "\n") { SifttterRedux::CLIMessage::success('test') }
  end

  def test_warning_message
    assert_output('# test'.yellow + "\n") { SifttterRedux::CLIMessage::warning('test') }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sifttter-redux-0.5.4 test/cli_message_test.rb
sifttter-redux-0.5.3 test/cli_message_test.rb
sifttter-redux-0.5.2 test/cli_message_test.rb