Sha256: df2bca83c478566b1b6d1b746d0aff3834d6b52329f4df78aa3214b86307559e

Contents?: true

Size: 1.67 KB

Versions: 45

Compression:

Stored size: 1.67 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')

describe ::Inch::CLI::Command::Stats do
  before do
    Dir.chdir fixture_path(:simple)
    @command = ::Inch::CLI::Command::Stats
  end

  it "should run without args" do
    out, err = capture_io do
      @command.run()
    end
    refute out.empty?, "there should be some output"
    assert err.empty?, "there should be no errors"
  end

  it "should run with filelist in args" do
    out, err = capture_io do
      @command.run("lib/**/*.rb", "app/**/*.rb")
    end
    refute out.empty?, "there should be some output"
    assert err.empty?, "there should be no errors"
  end

  it "should run even with non-existing filelist in args" do
    out, err = capture_io do
      @command.run("app/**/*.rb")
    end
    refute out.empty?, "there should be some output"
    assert err.empty?, "there should be no errors"
  end

  it "should output info when run with --format=json" do
    out, err = capture_io do
      @command.run("--format=json")
    end
    refute out.empty?, "there should be some output"
    assert err.empty?, "there should be no errors: #{err.yellow}"
  end

  it "should output info when run with --format=yaml" do
    out, err = capture_io do
      @command.run("--format=yaml")
    end
    refute out.empty?, "there should be some output"
    assert err.empty?, "there should be no errors: #{err.yellow}"
  end

  it "should output info when run with --help" do
    out, err = capture_io do
      assert_raises(SystemExit) { @command.run("--help") }
    end
    refute out.empty?, "there should be some output"
    assert_match /\bUsage\b.+stats/, out
    assert err.empty?, "there should be no errors"
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
inch-0.5.0.rc3 test/integration/cli/command/stats_test.rb
inch-0.5.0.rc2 test/integration/cli/command/stats_test.rb
inch-0.5.0.rc1 test/integration/cli/command/stats_test.rb
inch-0.4.6 test/integration/cli/command/stats_test.rb
inch-0.4.5 test/integration/cli/command/stats_test.rb
inch-0.4.4 test/integration/cli/command/stats_test.rb
inch-0.4.4.rc4 test/integration/cli/command/stats_test.rb
inch-0.4.4.rc3 test/integration/cli/command/stats_test.rb
inch-0.4.4.rc2 test/integration/cli/command/stats_test.rb
inch-0.4.4.rc1 test/integration/cli/command/stats_test.rb
inch-0.4.3 test/integration/cli/command/stats_test.rb
inch-0.4.3.rc2 test/integration/cli/command/stats_test.rb
inch-0.4.3.rc1 test/integration/cli/command/stats_test.rb
inch-0.4.2 test/integration/cli/command/stats_test.rb
inch-0.4.1 test/integration/cli/command/stats_test.rb
inch-0.4.0 test/integration/cli/command/stats_test.rb
inch-0.4.0.rc3 test/integration/cli/command/stats_test.rb
inch-0.4.0.rc2 test/integration/cli/command/stats_test.rb
inch-0.4.0.rc1 test/integration/cli/command/stats_test.rb
inch-0.3.4.rc1 test/integration/cli/command/stats_test.rb