Sha256: 1cc32001c6047f98df62bf253f2e008a7b9d85596284091da52436125ce5b840
Contents?: true
Size: 1.9 KB
Versions: 4
Compression:
Stored size: 1.9 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper') describe ::Inch::CLI::Command::Inspect do before do Dir.chdir fixture_path(:simple) @command = ::Inch::CLI::Command::Inspect end it "should warn and exit when run without args" do out, err = capture_io do assert_raises(SystemExit) { @command.run() } end assert out.empty?, "there should be no output" refute err.empty?, "there should be some error message" 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.+inspect/, out assert err.empty?, "there should be no errors" end it "should output some info when run with a definitive object name" do out, err = capture_io do @command.run("Foo::Bar#method_with_full_doc", "--no-color") end refute out.empty?, "there should be some output" assert_match /\bFoo::Bar#method_with_full_doc\b/, out refute_match(/\b Foo::Bar#method_without_doc\b/, out) assert err.empty?, "there should be no errors" end it "should output all children info when run with a partial name" do out, err = capture_io do @command.run("Foo::Bar#", "--no-color") end refute out.empty?, "there should be some output" assert_match /\bFoo::Bar#method_without_doc\b/, out assert_match /\bFoo::Bar#method_with_full_doc\b/, out assert err.empty?, "there should be no errors" end it "should output colored information" do out, err = capture_io do @command.run("Foo::Bar#") end refute_equal out.uncolor, out, "should be colored" end it "should output uncolored information when asked" do out, err = capture_io do @command.run("Foo::Bar#", "--no-color") end assert_equal out.uncolor, out, "should not be colored" end end
Version data entries
4 entries across 4 versions & 1 rubygems