Sha256: 5214cb98bc3c9368f4f3abdccb1f85a7fd98c9114f193e0fa12c3cde0e874235

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# -*- coding: utf-8 -*-
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")

describe CliTree do

  it "help message" do
    out = with_stdout_captured do
      args = %w{-h}
      CliTree.new.parse_args(args)
    end
    out.should match /Usage:/
  end

  it "version" do
    out = with_stdout_captured do
      args = %w{--version}
      CliTree.new.parse_args(args)
    end
    version = "0.1.4"
    out.should match version
  end

  it "should accepts switch -d (directories only)" do
    out = with_stdout_captured do
      args = %w{-d}
      args << TEST_DIR
      CliTree.new.parse_args(args)
    end
    # pp out
    out.split("\n").length.should == 6

    out = with_stdout_captured do
      args = %w{-da}
      args << TEST_DIR
      CliTree.new.parse_args(args)
    end
    #puts out
    out.split("\n").length.should == 7
  end

  it "should accepts switch -a (all files)" do
    out = with_stdout_captured do
      args = %w{-a}
      args << TEST_DIR
      CliTree.new.parse_args(args)
    end
    # pp out
    out.split("\n").length.should == 11

    out = with_stdout_captured do
      args = []
      args << TEST_DIR
      CliTree.new.parse_args(args)
    end
    # puts out
    out.split("\n").length.should == 9
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
treevisitor-0.1.4 spec/treevisitor/cli/cli_tree_spec.rb