Sha256: d165b67c46c85a1b22314e3c711c882bc30554dc40650da6377934138cc641cd

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 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 = TreeVisitor::VERSION
    out.should match version
  end

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

    out = with_stdout_captured do
      args = %w{-da}
      args << File.join(FIXTURES, "test_dir_1")
      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 << File.join(FIXTURES, "test_dir_1")
      CliTree.new.parse_args(args)
    end
    # pp out
    out.split("\n").length.should == 11

    out = with_stdout_captured do
      args = []
      args << File.join(FIXTURES, "test_dir_1")
      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.2.2 spec/treevisitor/cli/cli_tree_spec.rb