inch 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +335 -3
- data/Rakefile +8 -0
- data/TODOS.md +12 -0
- data/bin/inch +17 -0
- data/inch.gemspec +7 -2
- data/lib/inch.rb +6 -1
- data/lib/inch/cli.rb +24 -0
- data/lib/inch/cli/arguments.rb +45 -0
- data/lib/inch/cli/command.rb +29 -0
- data/lib/inch/cli/command/base.rb +62 -0
- data/lib/inch/cli/command/base_list.rb +75 -0
- data/lib/inch/cli/command/base_object.rb +40 -0
- data/lib/inch/cli/command/console.rb +22 -0
- data/lib/inch/cli/command/inspect.rb +20 -0
- data/lib/inch/cli/command/list.rb +25 -0
- data/lib/inch/cli/command/options/base.rb +137 -0
- data/lib/inch/cli/command/options/base_list.rb +84 -0
- data/lib/inch/cli/command/options/base_object.rb +47 -0
- data/lib/inch/cli/command/options/console.rb +26 -0
- data/lib/inch/cli/command/options/inspect.rb +25 -0
- data/lib/inch/cli/command/options/list.rb +30 -0
- data/lib/inch/cli/command/options/show.rb +27 -0
- data/lib/inch/cli/command/options/stats.rb +20 -0
- data/lib/inch/cli/command/options/suggest.rb +61 -0
- data/lib/inch/cli/command/output/base.rb +32 -0
- data/lib/inch/cli/command/output/console.rb +45 -0
- data/lib/inch/cli/command/output/inspect.rb +129 -0
- data/lib/inch/cli/command/output/list.rb +87 -0
- data/lib/inch/cli/command/output/show.rb +79 -0
- data/lib/inch/cli/command/output/stats.rb +111 -0
- data/lib/inch/cli/command/output/suggest.rb +104 -0
- data/lib/inch/cli/command/show.rb +20 -0
- data/lib/inch/cli/command/stats.rb +20 -0
- data/lib/inch/cli/command/suggest.rb +104 -0
- data/lib/inch/cli/command_parser.rb +82 -0
- data/lib/inch/cli/sparkline_helper.rb +31 -0
- data/lib/inch/cli/trace_helper.rb +42 -0
- data/lib/inch/cli/yardopts_helper.rb +49 -0
- data/lib/inch/code_object.rb +8 -0
- data/lib/inch/code_object/docstring.rb +97 -0
- data/lib/inch/code_object/nodoc_helper.rb +84 -0
- data/lib/inch/code_object/proxy.rb +37 -0
- data/lib/inch/code_object/proxy/base.rb +194 -0
- data/lib/inch/code_object/proxy/class_object.rb +9 -0
- data/lib/inch/code_object/proxy/constant_object.rb +8 -0
- data/lib/inch/code_object/proxy/method_object.rb +118 -0
- data/lib/inch/code_object/proxy/method_parameter_object.rb +81 -0
- data/lib/inch/code_object/proxy/module_object.rb +8 -0
- data/lib/inch/code_object/proxy/namespace_object.rb +38 -0
- data/lib/inch/core_ext.rb +2 -0
- data/lib/inch/core_ext/string.rb +3 -0
- data/lib/inch/core_ext/yard.rb +4 -0
- data/lib/inch/evaluation.rb +35 -0
- data/lib/inch/evaluation/base.rb +60 -0
- data/lib/inch/evaluation/class_object.rb +6 -0
- data/lib/inch/evaluation/constant_object.rb +34 -0
- data/lib/inch/evaluation/file.rb +66 -0
- data/lib/inch/evaluation/method_object.rb +127 -0
- data/lib/inch/evaluation/module_object.rb +6 -0
- data/lib/inch/evaluation/namespace_object.rb +94 -0
- data/lib/inch/evaluation/role/base.rb +49 -0
- data/lib/inch/evaluation/role/constant.rb +43 -0
- data/lib/inch/evaluation/role/method.rb +60 -0
- data/lib/inch/evaluation/role/method_parameter.rb +46 -0
- data/lib/inch/evaluation/role/missing.rb +20 -0
- data/lib/inch/evaluation/role/namespace.rb +58 -0
- data/lib/inch/evaluation/role/object.rb +64 -0
- data/lib/inch/evaluation/score_range.rb +26 -0
- data/lib/inch/rake.rb +1 -0
- data/lib/inch/rake/suggest.rb +26 -0
- data/lib/inch/source_parser.rb +36 -0
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/code_examples/lib/foo.rb +87 -0
- data/test/fixtures/readme/lib/foo.rb +17 -0
- data/test/fixtures/simple/README +25 -0
- data/test/fixtures/simple/lib/broken.rb +10 -0
- data/test/fixtures/simple/lib/foo.rb +214 -0
- data/test/fixtures/simple/lib/role_methods.rb +78 -0
- data/test/fixtures/simple/lib/role_namespaces.rb +68 -0
- data/test/fixtures/visibility/lib/foo.rb +18 -0
- data/test/fixtures/yardopts/.yardopts +1 -0
- data/test/fixtures/yardopts/foo/bar.rb +6 -0
- data/test/inch/cli/arguments_test.rb +70 -0
- data/test/inch/cli/command/console_test.rb +59 -0
- data/test/inch/cli/command/inspect_test.rb +59 -0
- data/test/inch/cli/command/list_test.rb +61 -0
- data/test/inch/cli/command/show_test.rb +59 -0
- data/test/inch/cli/command/stats_test.rb +57 -0
- data/test/inch/cli/command/suggest_test.rb +57 -0
- data/test/inch/cli/command_parser_test.rb +33 -0
- data/test/inch/cli/yardopts_helper_test.rb +84 -0
- data/test/inch/code_object/docstring_test.rb +204 -0
- data/test/inch/code_object/nodoc_helper_test.rb +38 -0
- data/test/inch/code_object/proxy_test.rb +188 -0
- data/test/inch/source_parser_test.rb +23 -0
- data/test/integration/stats_options_test.rb +34 -0
- data/test/integration/visibility_options_test.rb +79 -0
- data/test/test_helper.rb +21 -0
- metadata +184 -7
@@ -0,0 +1,78 @@
|
|
1
|
+
def root_method
|
2
|
+
end
|
3
|
+
|
4
|
+
module InchTest
|
5
|
+
def bang_method!
|
6
|
+
end
|
7
|
+
|
8
|
+
def splat_method(*args)
|
9
|
+
end
|
10
|
+
|
11
|
+
def block_method(&block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def question_mark_method?
|
15
|
+
if true
|
16
|
+
bang_method!
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def many_parameters_method(a,b,c,d,e,f)
|
21
|
+
end
|
22
|
+
|
23
|
+
def alias_method
|
24
|
+
end
|
25
|
+
alias :am :alias_method
|
26
|
+
|
27
|
+
def many_lines_method
|
28
|
+
if true
|
29
|
+
if true
|
30
|
+
if true
|
31
|
+
if true
|
32
|
+
bang_method!
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
if true
|
38
|
+
if true
|
39
|
+
if true
|
40
|
+
if true
|
41
|
+
bang_method!
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
if true
|
47
|
+
if true
|
48
|
+
if true
|
49
|
+
if true
|
50
|
+
bang_method!
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# @deprecated
|
58
|
+
# @see InchTest
|
59
|
+
def unconsidered_tags_method
|
60
|
+
end
|
61
|
+
public :public_method
|
62
|
+
|
63
|
+
def public_method
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
def protected_method
|
68
|
+
end
|
69
|
+
protected :protected_method
|
70
|
+
|
71
|
+
def private_method
|
72
|
+
end
|
73
|
+
private :private_method
|
74
|
+
|
75
|
+
# @private
|
76
|
+
def method_with_private_tag
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
|
2
|
+
# @deprecated
|
3
|
+
# @see PureNamespace
|
4
|
+
PUBLIC_ROOT_CONSTANT = :foo
|
5
|
+
|
6
|
+
class String
|
7
|
+
def foobar
|
8
|
+
self + 'foobar!'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module InchTest
|
13
|
+
# You would want to use it like this:
|
14
|
+
#
|
15
|
+
# CodeExample.new
|
16
|
+
#
|
17
|
+
class CodeExample
|
18
|
+
end
|
19
|
+
|
20
|
+
# You would want to use it like this:
|
21
|
+
#
|
22
|
+
# CodeExample.new
|
23
|
+
#
|
24
|
+
# CodeExample.new # => something
|
25
|
+
#
|
26
|
+
class MultipleCodeExamples
|
27
|
+
end
|
28
|
+
|
29
|
+
module PureNamespace
|
30
|
+
end
|
31
|
+
|
32
|
+
# @deprecated
|
33
|
+
# @see PureNamespace
|
34
|
+
module ManyChildren
|
35
|
+
class Base0; end
|
36
|
+
class Base1; end
|
37
|
+
class Base2; end
|
38
|
+
class Base3; end
|
39
|
+
class Base4; end
|
40
|
+
class Base5; end
|
41
|
+
class Base6; end
|
42
|
+
class Base7; end
|
43
|
+
class Base8; end
|
44
|
+
class Base9; end
|
45
|
+
class Base10; end
|
46
|
+
class Base11; end
|
47
|
+
class Base12; end
|
48
|
+
class Base13; end
|
49
|
+
class Base14; end
|
50
|
+
class Base15; end
|
51
|
+
class Base16; end
|
52
|
+
class Base17; end
|
53
|
+
class Base18; end
|
54
|
+
class Base19; end
|
55
|
+
class Base20; end
|
56
|
+
class Base21; end
|
57
|
+
end
|
58
|
+
|
59
|
+
module ManyAttributes
|
60
|
+
attr_accessor :base0
|
61
|
+
attr_accessor :base1
|
62
|
+
attr_accessor :base2
|
63
|
+
attr_accessor :base3
|
64
|
+
attr_accessor :base4
|
65
|
+
attr_accessor :base5
|
66
|
+
attr_accessor :base6
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
foo/**/*.rb
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
2
|
+
|
3
|
+
describe ::Inch::CLI::Arguments do
|
4
|
+
before do
|
5
|
+
Dir.chdir fixture_path(:simple)
|
6
|
+
assert File.file?("README")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should run with files" do
|
10
|
+
args = [
|
11
|
+
"lib/**/*.rb", "app/**/*.rb", "README"
|
12
|
+
]
|
13
|
+
arguments = ::Inch::CLI::Arguments.new(args)
|
14
|
+
assert_equal ["lib/**/*.rb", "app/**/*.rb", "README"], arguments.files
|
15
|
+
assert_equal [], arguments.object_names
|
16
|
+
assert_equal [], arguments.switches
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should run with directories as well" do
|
20
|
+
args = [
|
21
|
+
"lib", "app/**/*.rb", "README"
|
22
|
+
]
|
23
|
+
arguments = ::Inch::CLI::Arguments.new(args)
|
24
|
+
assert_equal ["lib", "app/**/*.rb", "README"], arguments.files
|
25
|
+
assert_equal [], arguments.object_names
|
26
|
+
assert_equal [], arguments.switches
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should run with files and object_name" do
|
30
|
+
args = [
|
31
|
+
"{app,lib}.rb", "README", "Foo"
|
32
|
+
]
|
33
|
+
arguments = ::Inch::CLI::Arguments.new(args)
|
34
|
+
assert_equal ["{app,lib}.rb", "README"], arguments.files
|
35
|
+
assert_equal ["Foo"], arguments.object_names
|
36
|
+
assert_equal [], arguments.switches
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should run with object_names" do
|
40
|
+
args = [
|
41
|
+
"Foo::Bar"
|
42
|
+
]
|
43
|
+
arguments = ::Inch::CLI::Arguments.new(args)
|
44
|
+
assert_equal [], arguments.files, "files"
|
45
|
+
assert_equal ["Foo::Bar"], arguments.object_names
|
46
|
+
assert_equal [], arguments.switches
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should run with option switches" do
|
50
|
+
args = [
|
51
|
+
"--no-color", "--all"
|
52
|
+
]
|
53
|
+
arguments = ::Inch::CLI::Arguments.new(args)
|
54
|
+
assert_equal [], arguments.files
|
55
|
+
assert_equal [], arguments.object_names
|
56
|
+
assert_equal ["--no-color", "--all"], arguments.switches
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should run with all of them" do
|
60
|
+
args = [
|
61
|
+
"lib/**/*.rb", "app/**/*.rb", "README",
|
62
|
+
"Foo", "Foo::Bar", "--no-color", "--all"
|
63
|
+
]
|
64
|
+
arguments = ::Inch::CLI::Arguments.new(args)
|
65
|
+
assert_equal ["lib/**/*.rb", "app/**/*.rb", "README"], arguments.files
|
66
|
+
assert_equal ["Foo", "Foo::Bar"], arguments.object_names
|
67
|
+
assert_equal ["--no-color", "--all"], arguments.switches
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
2
|
+
|
3
|
+
class Inch::CLI::Command::Output::Console
|
4
|
+
def run_pry
|
5
|
+
nil # instead of binding.pry
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ::Inch::CLI::Command::Console do
|
10
|
+
before do
|
11
|
+
Dir.chdir fixture_path(:simple)
|
12
|
+
@command = ::Inch::CLI::Command::Console
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should output info when run with --help" do
|
16
|
+
out, err = capture_io do
|
17
|
+
assert_raises(SystemExit) { @command.run("--help") }
|
18
|
+
end
|
19
|
+
refute out.empty?, "there should be some output"
|
20
|
+
assert_match /\bUsage\b.+console/, out
|
21
|
+
assert err.empty?, "there should be no errors"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should run without args" do
|
25
|
+
out, err = capture_io do
|
26
|
+
@prompt = @command.new.run()
|
27
|
+
end
|
28
|
+
assert @prompt.respond_to?(:all)
|
29
|
+
assert @prompt.respond_to?(:ff)
|
30
|
+
assert @prompt.respond_to?(:f)
|
31
|
+
assert @prompt.respond_to?(:o)
|
32
|
+
assert @prompt.o.nil?
|
33
|
+
assert @prompt.objects.empty?
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should run with a definitive object name" do
|
37
|
+
out, err = capture_io do
|
38
|
+
@prompt = @command.new.run("Foo::Bar#method_with_full_doc")
|
39
|
+
end
|
40
|
+
assert @prompt.respond_to?(:all)
|
41
|
+
assert @prompt.respond_to?(:ff)
|
42
|
+
assert @prompt.respond_to?(:f)
|
43
|
+
assert @prompt.respond_to?(:o)
|
44
|
+
refute @prompt.o.nil?
|
45
|
+
assert_equal 1, @prompt.objects.size
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should run with a partial name" do
|
49
|
+
out, err = capture_io do
|
50
|
+
@prompt = @command.new.run("Foo::Bar#")
|
51
|
+
end
|
52
|
+
assert @prompt.respond_to?(:all)
|
53
|
+
assert @prompt.respond_to?(:ff)
|
54
|
+
assert @prompt.respond_to?(:f)
|
55
|
+
assert @prompt.respond_to?(:o)
|
56
|
+
refute @prompt.o.nil?
|
57
|
+
assert @prompt.objects.size > 1
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
2
|
+
|
3
|
+
describe ::Inch::CLI::Command::Inspect do
|
4
|
+
before do
|
5
|
+
Dir.chdir fixture_path(:simple)
|
6
|
+
@command = ::Inch::CLI::Command::Inspect
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should warn and exit when run without args" do
|
10
|
+
out, err = capture_io do
|
11
|
+
assert_raises(SystemExit) { @command.run() }
|
12
|
+
end
|
13
|
+
assert out.empty?, "there should be no output"
|
14
|
+
refute err.empty?, "there should be some error message"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should output info when run with --help" do
|
18
|
+
out, err = capture_io do
|
19
|
+
assert_raises(SystemExit) { @command.run("--help") }
|
20
|
+
end
|
21
|
+
refute out.empty?, "there should be some output"
|
22
|
+
assert_match /\bUsage\b.+inspect/, out
|
23
|
+
assert err.empty?, "there should be no errors"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should output some info when run with a definitive object name" do
|
27
|
+
out, err = capture_io do
|
28
|
+
@command.run("Foo::Bar#method_with_full_doc", "--no-color")
|
29
|
+
end
|
30
|
+
refute out.empty?, "there should be some output"
|
31
|
+
assert_match /\bFoo::Bar#method_with_full_doc\b/, out
|
32
|
+
refute_match(/\b Foo::Bar#method_without_doc\b/, out)
|
33
|
+
assert err.empty?, "there should be no errors"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should output all children info when run with a partial name" do
|
37
|
+
out, err = capture_io do
|
38
|
+
@command.run("Foo::Bar#", "--no-color")
|
39
|
+
end
|
40
|
+
refute out.empty?, "there should be some output"
|
41
|
+
assert_match /\bFoo::Bar#method_without_doc\b/, out
|
42
|
+
assert_match /\bFoo::Bar#method_with_full_doc\b/, out
|
43
|
+
assert err.empty?, "there should be no errors"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should output colored information" do
|
47
|
+
out, err = capture_io do
|
48
|
+
@command.run("Foo::Bar#")
|
49
|
+
end
|
50
|
+
refute_equal out.uncolor, out, "should be colored"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should output uncolored information when asked" do
|
54
|
+
out, err = capture_io do
|
55
|
+
@command.run("Foo::Bar#", "--no-color")
|
56
|
+
end
|
57
|
+
assert_equal out.uncolor, out, "should not be colored"
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
2
|
+
|
3
|
+
describe ::Inch::CLI::Command::List do
|
4
|
+
before do
|
5
|
+
Dir.chdir fixture_path(:simple)
|
6
|
+
@command = ::Inch::CLI::Command::List
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should run without args" do
|
10
|
+
out, err = capture_io do
|
11
|
+
@command.run()
|
12
|
+
end
|
13
|
+
refute out.empty?, "there should be some output"
|
14
|
+
assert err.empty?, "there should be no errors"
|
15
|
+
assert_match /\bFoo\b/, out
|
16
|
+
assert_match /\bFoo::Bar\b/, out
|
17
|
+
assert_match /\bFoo::Bar#method_with_full_doc\b/, out
|
18
|
+
assert_match /\bFoo::Bar#method_with_code_example\b/, out
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should run with --numbers switch" do
|
22
|
+
out, err = capture_io do
|
23
|
+
@command.run("--numbers")
|
24
|
+
end
|
25
|
+
refute out.empty?, "there should be some output"
|
26
|
+
assert err.empty?, "there should be no errors"
|
27
|
+
assert_match /\bFoo\b/, out
|
28
|
+
assert_match /\bFoo::Bar\b/, out
|
29
|
+
assert_match /\bFoo::Bar#method_with_full_doc\b/, out
|
30
|
+
assert_match /\bFoo::Bar#method_with_code_example\b/, out
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should run with filelist in args" do
|
34
|
+
out, err = capture_io do
|
35
|
+
@command.run("lib/**/*.rb", "app/**/*.rb")
|
36
|
+
end
|
37
|
+
refute out.empty?, "there should be some output"
|
38
|
+
assert err.empty?, "there should be no errors"
|
39
|
+
assert_match /\bFoo\b/, out
|
40
|
+
assert_match /\bFoo::Bar\b/, out
|
41
|
+
assert_match /\bFoo::Bar#method_with_full_doc\b/, out
|
42
|
+
assert_match /\bFoo::Bar#method_with_code_example\b/, out
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should run with non-existing filelist in args" do
|
46
|
+
out, err = capture_io do
|
47
|
+
@command.run("app/**/*.rb")
|
48
|
+
end
|
49
|
+
assert out.empty?, "there should be no output"
|
50
|
+
assert err.empty?, "there should be no errors"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should output info when run with --help" do
|
54
|
+
out, err = capture_io do
|
55
|
+
assert_raises(SystemExit) { @command.run("--help") }
|
56
|
+
end
|
57
|
+
refute out.empty?, "there should be some output"
|
58
|
+
assert_match /\bUsage\b.+list/, out
|
59
|
+
assert err.empty?, "there should be no errors"
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
2
|
+
|
3
|
+
describe ::Inch::CLI::Command::Show do
|
4
|
+
before do
|
5
|
+
Dir.chdir fixture_path(:simple)
|
6
|
+
@command = ::Inch::CLI::Command::Show
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should warn and exit when run without args" do
|
10
|
+
out, err = capture_io do
|
11
|
+
assert_raises(SystemExit) { @command.run() }
|
12
|
+
end
|
13
|
+
assert out.empty?, "there should be no output"
|
14
|
+
refute err.empty?, "there should be some error message"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should output info when run with --help" do
|
18
|
+
out, err = capture_io do
|
19
|
+
assert_raises(SystemExit) { @command.run("--help") }
|
20
|
+
end
|
21
|
+
refute out.empty?, "there should be some output"
|
22
|
+
assert_match /\bUsage\b.+show/, out
|
23
|
+
assert err.empty?, "there should be no errors"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should output some info when run with a definitive object name" do
|
27
|
+
out, err = capture_io do
|
28
|
+
@command.run("Foo::Bar#method_with_full_doc", "--no-color")
|
29
|
+
end
|
30
|
+
refute out.empty?, "there should be some output"
|
31
|
+
assert_match /\bFoo::Bar#method_with_full_doc\b/, out
|
32
|
+
refute_match(/\b Foo::Bar#method_without_doc\b/, out)
|
33
|
+
assert err.empty?, "there should be no errors"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should output all children info when run with a partial name" do
|
37
|
+
out, err = capture_io do
|
38
|
+
@command.run("Foo::Bar#", "--no-color")
|
39
|
+
end
|
40
|
+
refute out.empty?, "there should be some output"
|
41
|
+
assert_match /\bFoo::Bar#method_without_doc\b/, out
|
42
|
+
assert_match /\bFoo::Bar#method_with_full_doc\b/, out
|
43
|
+
assert err.empty?, "there should be no errors"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should output colored information" do
|
47
|
+
out, err = capture_io do
|
48
|
+
@command.run("Foo::Bar#")
|
49
|
+
end
|
50
|
+
refute_equal out.uncolor, out, "should be colored"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should output uncolored information when asked" do
|
54
|
+
out, err = capture_io do
|
55
|
+
@command.run("Foo::Bar#", "--no-color")
|
56
|
+
end
|
57
|
+
assert_equal out.uncolor, out, "should not be colored"
|
58
|
+
end
|
59
|
+
end
|