Sha256: 6806efe069c3611f74eb0516b35bb32c470c7c4a78cdf95d1e4fa3075e19bad1

Contents?: true

Size: 1.74 KB

Versions: 25

Compression:

Stored size: 1.74 KB

Contents

require 'helper'

class TestApplications < Test::Unit::TestCase
  
  include CSD
  
  context "The CLI instance" do
  
    setup do
      Options.clear
      Options.testmode = true
      Options.silent = false
      assert_instance_of UserInterface::CLI, CSD.ui
    end
    
    should "be able to indicate activity by printing periods" do
      out, err = capture do
        UI.indicate_activity
        UI.indicate_activity
        UI.indicate_activity
      end
      assert_equal '...', out
      assert_equal '', err
    end
  
    should "represent a separator by a new line" do
      out, err = capture do
        UI.separator
        UI.separator
        UI.separator
      end
      assert_equal "\n\n\n", out
      assert_equal '', err
    end

    should "log debugging messages in debug mode" do
      Options.debug = true
      out, err = capture do
        UI.debug "debugging"
      end
      assert_match /debugging/, out
      assert_equal '', err
    end
    
    should "NOT log debugging messages UNLESS debug mode" do
      Options.debug = false
      out, err = capture do
        UI.debug "debugging"
      end
      assert_equal '', out
      assert_equal '', err
    end
    
    should "log info messages" do
      out, err = capture do
        UI.info "informing"
      end
      assert_match /informing/, out
      assert_equal '', err
    end
    
    should "log warning messages" do
      out, err = capture do
        UI.warn "waaarning"
      end
      assert_match /waaarning/, out
      assert_equal '', err
    end
    
    should "log error messages to STDOUT" do
      out, err = capture do
        UI.error "erroring"
      end
      assert_equal '', out
      assert_match /erroring/, err
    end
   
  end # context "An CLI instance"

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
csd-0.4.3 test/functional/test_cli.rb
csd-0.4.2 test/functional/test_cli.rb
csd-0.4.1 test/functional/test_cli.rb
csd-0.4.0 test/functional/test_cli.rb
csd-0.3.7 test/functional/test_cli.rb
csd-0.3.6 test/functional/test_cli.rb
csd-0.3.5 test/functional/test_cli.rb
csd-0.3.4 test/functional/test_cli.rb
csd-0.3.3 test/functional/test_cli.rb
csd-0.3.2 test/functional/test_cli.rb
csd-0.3.1 test/functional/test_cli.rb
csd-0.3.0 test/functional/test_cli.rb
csd-0.2.2 test/functional/test_cli.rb
csd-0.2.1 test/functional/test_cli.rb
csd-0.2.0 test/functional/test_cli.rb
csd-0.1.18 test/functional/test_cli.rb
csd-0.1.17 test/functional/test_cli.rb
csd-0.1.16 test/functional/test_cli.rb
csd-0.1.15 test/functional/test_cli.rb
csd-0.1.14 test/functional/test_cli.rb