inch 0.4.10 → 0.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -11
  3. data/Gemfile +2 -5
  4. data/README.md +1 -1
  5. data/Rakefile +2 -2
  6. data/bin/inch +3 -3
  7. data/config/defaults.rb +0 -7
  8. data/inch.gemspec +7 -7
  9. data/lib/inch.rb +9 -9
  10. data/lib/inch/api.rb +10 -10
  11. data/lib/inch/api/compare.rb +2 -2
  12. data/lib/inch/api/compare/code_objects.rb +3 -2
  13. data/lib/inch/api/compare/codebases.rb +1 -1
  14. data/lib/inch/api/diff.rb +10 -7
  15. data/lib/inch/api/filter.rb +1 -1
  16. data/lib/inch/api/get.rb +1 -1
  17. data/lib/inch/api/options/base.rb +4 -4
  18. data/lib/inch/api/options/filter.rb +4 -0
  19. data/lib/inch/api/options/suggest.rb +5 -1
  20. data/lib/inch/api/stats.rb +1 -0
  21. data/lib/inch/api/suggest.rb +10 -9
  22. data/lib/inch/cli.rb +6 -6
  23. data/lib/inch/cli/arguments.rb +2 -2
  24. data/lib/inch/cli/command.rb +15 -15
  25. data/lib/inch/cli/command/base.rb +4 -4
  26. data/lib/inch/cli/command/console.rb +5 -5
  27. data/lib/inch/cli/command/diff.rb +8 -7
  28. data/lib/inch/cli/command/inspect.rb +4 -5
  29. data/lib/inch/cli/command/list.rb +4 -4
  30. data/lib/inch/cli/command/options/base.rb +8 -8
  31. data/lib/inch/cli/command/options/base_list.rb +5 -9
  32. data/lib/inch/cli/command/options/console.rb +3 -4
  33. data/lib/inch/cli/command/options/diff.rb +6 -8
  34. data/lib/inch/cli/command/options/inspect.rb +2 -2
  35. data/lib/inch/cli/command/options/list.rb +2 -3
  36. data/lib/inch/cli/command/options/show.rb +2 -2
  37. data/lib/inch/cli/command/options/stats.rb +1 -2
  38. data/lib/inch/cli/command/options/suggest.rb +3 -6
  39. data/lib/inch/cli/command/output/base.rb +6 -4
  40. data/lib/inch/cli/command/output/console.rb +5 -4
  41. data/lib/inch/cli/command/output/diff.rb +6 -6
  42. data/lib/inch/cli/command/output/inspect.rb +8 -6
  43. data/lib/inch/cli/command/output/list.rb +1 -0
  44. data/lib/inch/cli/command/output/show.rb +5 -4
  45. data/lib/inch/cli/command/output/stats.rb +21 -21
  46. data/lib/inch/cli/command/output/suggest.rb +27 -30
  47. data/lib/inch/cli/command/show.rb +4 -4
  48. data/lib/inch/cli/command/stats.rb +4 -4
  49. data/lib/inch/cli/command/suggest.rb +6 -6
  50. data/lib/inch/cli/command_parser.rb +5 -6
  51. data/lib/inch/cli/sparkline_helper.rb +6 -6
  52. data/lib/inch/cli/trace_helper.rb +1 -1
  53. data/lib/inch/cli/yardopts_helper.rb +3 -4
  54. data/lib/inch/code_object.rb +3 -3
  55. data/lib/inch/code_object/converter.rb +8 -6
  56. data/lib/inch/code_object/provider.rb +1 -1
  57. data/lib/inch/code_object/provider/yard.rb +12 -10
  58. data/lib/inch/code_object/provider/yard/docstring.rb +19 -51
  59. data/lib/inch/code_object/provider/yard/nodoc_helper.rb +4 -4
  60. data/lib/inch/code_object/provider/yard/object.rb +10 -12
  61. data/lib/inch/code_object/provider/yard/object/base.rb +27 -48
  62. data/lib/inch/code_object/provider/yard/object/method_object.rb +10 -47
  63. data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +6 -10
  64. data/lib/inch/code_object/provider/yard/object/method_signature.rb +8 -12
  65. data/lib/inch/code_object/provider/yard/object/namespace_object.rb +4 -1
  66. data/lib/inch/code_object/provider/yard/parser.rb +3 -3
  67. data/lib/inch/code_object/proxy.rb +9 -10
  68. data/lib/inch/code_object/proxy/base.rb +10 -12
  69. data/lib/inch/code_object/proxy/method_object.rb +2 -3
  70. data/lib/inch/code_object/proxy/method_parameter_object.rb +3 -5
  71. data/lib/inch/codebase.rb +5 -4
  72. data/lib/inch/codebase/objects_filter.rb +4 -2
  73. data/lib/inch/codebase/serializer.rb +3 -3
  74. data/lib/inch/config.rb +2 -2
  75. data/lib/inch/config/base.rb +1 -0
  76. data/lib/inch/config/codebase.rb +4 -4
  77. data/lib/inch/core_ext.rb +1 -1
  78. data/lib/inch/core_ext/string.rb +1 -1
  79. data/lib/inch/evaluation.rb +15 -16
  80. data/lib/inch/evaluation/file.rb +1 -1
  81. data/lib/inch/evaluation/grade_list.rb +2 -2
  82. data/lib/inch/evaluation/object_schema.rb +1 -1
  83. data/lib/inch/evaluation/proxy.rb +7 -8
  84. data/lib/inch/evaluation/proxy/base.rb +10 -13
  85. data/lib/inch/evaluation/proxy/constant_object.rb +1 -1
  86. data/lib/inch/evaluation/proxy/method_object.rb +5 -12
  87. data/lib/inch/evaluation/proxy/module_object.rb +1 -1
  88. data/lib/inch/evaluation/proxy/namespace_object.rb +1 -1
  89. data/lib/inch/evaluation/role/base.rb +1 -1
  90. data/lib/inch/evaluation/role/method.rb +2 -2
  91. data/lib/inch/evaluation/role/method_parameter.rb +1 -2
  92. data/lib/inch/evaluation/role/object.rb +2 -2
  93. data/lib/inch/rake.rb +2 -2
  94. data/lib/inch/rake/suggest.rb +2 -3
  95. data/lib/inch/utils/shell_helper.rb +1 -1
  96. data/lib/inch/utils/ui.rb +5 -5
  97. data/lib/inch/utils/weighted_list.rb +3 -2
  98. data/lib/inch/version.rb +1 -1
  99. data/test/fixtures/simple/lib/broken.rb +7 -35
  100. data/test/fixtures/simple/lib/foo.rb +1 -22
  101. data/test/integration/api/compare/codebases.rb +1 -1
  102. data/test/integration/cli/command/console_test.rb +5 -5
  103. data/test/integration/cli/command/inspect_test.rb +5 -4
  104. data/test/integration/cli/command/list_test.rb +4 -3
  105. data/test/integration/cli/command/show_test.rb +4 -4
  106. data/test/integration/cli/command/stats_test.rb +2 -2
  107. data/test/integration/cli/command/suggest_test.rb +10 -10
  108. data/test/integration/stats_options_test.rb +3 -3
  109. data/test/integration/visibility_options_test.rb +13 -13
  110. data/test/shared/base_list.rb +3 -4
  111. data/test/test_helper.rb +6 -16
  112. data/test/unit/api/filter_test.rb +7 -7
  113. data/test/unit/api/get_test.rb +1 -1
  114. data/test/unit/api/list_test.rb +1 -1
  115. data/test/unit/api/options/base_test.rb +3 -3
  116. data/test/unit/api/stats_test.rb +1 -1
  117. data/test/unit/api/suggest_test.rb +3 -3
  118. data/test/unit/cli/arguments_test.rb +1 -1
  119. data/test/unit/cli/command/base_test.rb +1 -1
  120. data/test/unit/cli/command/options/base_list_test.rb +2 -2
  121. data/test/unit/cli/command/options/base_object_test.rb +1 -1
  122. data/test/unit/cli/command/options/base_test.rb +1 -1
  123. data/test/unit/cli/command_parser_test.rb +2 -2
  124. data/test/unit/cli/trace_helper_test.rb +1 -1
  125. data/test/unit/cli/yardopts_helper_test.rb +3 -4
  126. data/test/unit/code_object/converter_test.rb +1 -1
  127. data/test/unit/code_object/provider/yard/docstring_test.rb +28 -106
  128. data/test/unit/code_object/provider/yard/nodoc_helper_test.rb +5 -6
  129. data/test/unit/code_object/provider/yard/object/method_object_test.rb +10 -20
  130. data/test/unit/code_object/provider/yard_test.rb +4 -4
  131. data/test/unit/code_object/provider_test.rb +1 -1
  132. data/test/unit/code_object/proxy/method_object_test.rb +262 -382
  133. data/test/unit/code_object/proxy_test.rb +1 -1
  134. data/test/unit/codebase/objects_test.rb +2 -2
  135. data/test/unit/codebase/proxy_test.rb +1 -1
  136. data/test/unit/config/codebase_test.rb +1 -1
  137. data/test/unit/evaluation/role/base_test.rb +2 -2
  138. data/test/unit/utils/ui_test.rb +4 -4
  139. data/test/unit/utils/weighted_list_test.rb +4 -7
  140. metadata +4 -14
  141. data/.rubocop.yml +0 -15
  142. data/.rubocop_todo.yml +0 -94
  143. data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +0 -12
  144. data/lib/inch/code_object/proxy/class_variable_object.rb +0 -8
  145. data/lib/inch/evaluation/proxy/class_variable_object.rb +0 -19
  146. data/lib/inch/evaluation/role/class_variable.rb +0 -55
  147. data/test/fixtures/simple/lib/broken_ruby_2_0_features.rb +0 -7
  148. data/test/fixtures/simple/lib/directives.rb +0 -8
@@ -41,12 +41,8 @@ module Foo
41
41
  def method_without_docstring(p1, p2 = nil)
42
42
  end
43
43
 
44
- # @return [String]
45
- def method_without_params_or_docstring
46
- end
47
-
48
44
  # @return [void]
49
- def method_without_usable_return_value
45
+ def method_without_params_or_docstring
50
46
  end
51
47
 
52
48
  # Provides an example of a method without parameters
@@ -76,23 +72,6 @@ module Foo
76
72
  def method_with_other_rdoc_doc(param1, param2, param3)
77
73
  end
78
74
 
79
- # Injects text right after the class definition. Since it depends on
80
- # insert_into_file, it's reversible.
81
- #
82
- # ==== Parameters
83
- # param1<String>:: path of the file to be changed
84
- # param2<String|Class>:: the class to be manipulated
85
- #
86
- # ==== Examples
87
- #
88
- # inject_into_class "app/controllers/application_controller.rb", ApplicationController, " filter_parameter :password\n"
89
- #
90
- # inject_into_class "app/controllers/application_controller.rb", ApplicationController do
91
- # " filter_parameter :password\n"
92
- # end
93
- def method_with_yet_another_rdoc_doc(param1, param2)
94
- end
95
-
96
75
  # An example of a method that takes a parameter (+param1+)
97
76
  # and does nothing. But the previous sentence mentions said
98
77
  # parameter.
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
2
2
 
3
3
  describe ::Inch::API::Compare::Codebases do
4
4
  let(:described_class) { ::Inch::API::Compare::Codebases }
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
2
2
 
3
3
  class Inch::CLI::Command::Output::Console
4
4
  def run_pry
@@ -22,8 +22,8 @@ describe ::Inch::CLI::Command::Console do
22
22
  end
23
23
 
24
24
  it "should run without args" do
25
- _out, _err = capture_io do
26
- @prompt = @command.new.run
25
+ out, err = capture_io do
26
+ @prompt = @command.new.run()
27
27
  end
28
28
  assert @prompt.respond_to?(:all)
29
29
  assert @prompt.respond_to?(:ff)
@@ -34,7 +34,7 @@ describe ::Inch::CLI::Command::Console do
34
34
  end
35
35
 
36
36
  it "should run with a definitive object name" do
37
- _out, _err = capture_io do
37
+ out, err = capture_io do
38
38
  @prompt = @command.new.run("Foo::Bar#method_with_full_doc")
39
39
  end
40
40
  assert !@prompt.all.empty?
@@ -46,7 +46,7 @@ describe ::Inch::CLI::Command::Console do
46
46
  end
47
47
 
48
48
  it "should run with a partial name" do
49
- _out, _err = capture_io do
49
+ out, err = capture_io do
50
50
  @prompt = @command.new.run("Foo::Bar#")
51
51
  end
52
52
  assert @prompt.respond_to?(:all)
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
2
2
 
3
3
  describe ::Inch::CLI::Command::Inspect do
4
4
  before do
@@ -8,7 +8,7 @@ describe ::Inch::CLI::Command::Inspect do
8
8
 
9
9
  it "should warn and exit when run without args" do
10
10
  out, err = capture_io do
11
- assert_raises(SystemExit) { @command.run }
11
+ assert_raises(SystemExit) { @command.run() }
12
12
  end
13
13
  assert out.empty?, "there should be no output"
14
14
  refute err.empty?, "there should be some error message"
@@ -33,6 +33,7 @@ describe ::Inch::CLI::Command::Inspect do
33
33
  assert err.empty?, "there should be no errors"
34
34
  end
35
35
 
36
+
36
37
  it "should output some info when run with a definitive object name" do
37
38
  out, err = capture_io do
38
39
  @command.run("Foo::Qux")
@@ -52,14 +53,14 @@ describe ::Inch::CLI::Command::Inspect do
52
53
  end
53
54
 
54
55
  it "should output colored information" do
55
- out, _err = capture_io do
56
+ out, err = capture_io do
56
57
  @command.run("Foo::Bar#")
57
58
  end
58
59
  refute_equal out.uncolor, out, "should be colored"
59
60
  end
60
61
 
61
62
  it "should output uncolored information when asked" do
62
- out, _err = capture_io do
63
+ out, err = capture_io do
63
64
  @command.run("Foo::Bar#", "--no-color")
64
65
  end
65
66
  assert_equal out.uncolor, out, "should not be colored"
@@ -1,5 +1,5 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
2
- require File.expand_path(File.dirname(__FILE__) + "/../../../shared/base_list")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../shared/base_list')
3
3
 
4
4
  describe ::Inch::CLI::Command::List do
5
5
  before do
@@ -11,7 +11,7 @@ describe ::Inch::CLI::Command::List do
11
11
 
12
12
  it "should run without args" do
13
13
  out, err = capture_io do
14
- @command.run
14
+ @command.run()
15
15
  end
16
16
  refute out.empty?, "there should be some output"
17
17
  assert err.empty?, "there should be no errors"
@@ -62,3 +62,4 @@ describe ::Inch::CLI::Command::List do
62
62
  assert err.empty?, "there should be no errors"
63
63
  end
64
64
  end
65
+
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
2
2
 
3
3
  describe ::Inch::CLI::Command::Show do
4
4
  before do
@@ -8,7 +8,7 @@ describe ::Inch::CLI::Command::Show do
8
8
 
9
9
  it "should warn and exit when run without args" do
10
10
  out, err = capture_io do
11
- assert_raises(SystemExit) { @command.run }
11
+ assert_raises(SystemExit) { @command.run() }
12
12
  end
13
13
  assert out.empty?, "there should be no output"
14
14
  refute err.empty?, "there should be some error message"
@@ -44,14 +44,14 @@ describe ::Inch::CLI::Command::Show do
44
44
  end
45
45
 
46
46
  it "should output colored information" do
47
- out, _err = capture_io do
47
+ out, err = capture_io do
48
48
  @command.run("Foo::Bar#")
49
49
  end
50
50
  refute_equal out.uncolor, out, "should be colored"
51
51
  end
52
52
 
53
53
  it "should output uncolored information when asked" do
54
- out, _err = capture_io do
54
+ out, err = capture_io do
55
55
  @command.run("Foo::Bar#", "--no-color")
56
56
  end
57
57
  assert_equal out.uncolor, out, "should not be colored"
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
2
2
 
3
3
  describe ::Inch::CLI::Command::Stats do
4
4
  before do
@@ -8,7 +8,7 @@ describe ::Inch::CLI::Command::Stats do
8
8
 
9
9
  it "should run without args" do
10
10
  out, err = capture_io do
11
- @command.run
11
+ @command.run()
12
12
  end
13
13
  refute out.empty?, "there should be some output"
14
14
  assert err.empty?, "there should be no errors"
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
2
2
 
3
3
  describe ::Inch::CLI::Command::Suggest do
4
4
  before do
@@ -8,12 +8,12 @@ describe ::Inch::CLI::Command::Suggest do
8
8
 
9
9
  it "should run without args" do
10
10
  out, err = capture_io do
11
- @command.run
11
+ @command.run()
12
12
  end
13
13
  refute out.empty?, "there should be some output"
14
14
  assert err.empty?, "there should be no errors"
15
15
  assert_match /\bFoo::Bar#method_with_wrong_doc\b/, out
16
- assert_match /\bFoo::Bar#method_with_rdoc_doc\b/, out
16
+ assert_match /\bFoo::Bar#method_without_docstring\b/, out
17
17
  assert_match /\bFoo::Bar#method_with_unstructured_doc\b/, out
18
18
  end
19
19
 
@@ -32,18 +32,18 @@ describe ::Inch::CLI::Command::Suggest do
32
32
  refute out.empty?, "there should be some output"
33
33
  assert err.empty?, "there should be no errors"
34
34
  assert_match /\bFoo::Bar#method_with_wrong_doc\b/, out
35
- assert_match /\bFoo::Bar#method_with_rdoc_doc\b/, out
35
+ assert_match /\bFoo::Bar#method_without_docstring\b/, out
36
36
  assert_match /\bFoo::Bar#method_with_unstructured_doc\b/, out
37
37
  end
38
38
 
39
39
  it "should run with non-existing filelist in args" do
40
- _out, _err = capture_io do
40
+ out, err = capture_io do
41
41
  @command.run("app/**/*.rb")
42
42
  end
43
43
  # TODO: not sure what should actually happen here:
44
44
  # no output or error message?
45
- # assert out.empty?, "there should be no output"
46
- # assert err.empty?, "there should be no errors"
45
+ #assert out.empty?, "there should be no output"
46
+ #assert err.empty?, "there should be no errors"
47
47
  end
48
48
 
49
49
  it "should run with --objects switch" do
@@ -53,12 +53,12 @@ describe ::Inch::CLI::Command::Suggest do
53
53
  refute out.empty?, "there should be some output"
54
54
  assert err.empty?, "there should be no errors"
55
55
  assert_match /\bFoo::Bar#method_with_wrong_doc\b/, out
56
- assert_match /\bFoo::Bar#method_with_rdoc_doc\b/, out
56
+ assert_match /\bFoo::Bar#method_without_docstring\b/, out
57
57
  assert_match /\bFoo::Bar#method_with_unstructured_doc\b/, out
58
58
  end
59
59
 
60
60
  it "should give error when run with --unknown-switch" do
61
- _out, _err = capture_io do
61
+ out, err = capture_io do
62
62
  assert_raises(SystemExit) { @command.run("--unknown-switch") }
63
63
  end
64
64
  end
@@ -86,7 +86,7 @@ describe ::Inch::CLI::Command::Suggest do
86
86
  it "should run without args on really good fixture" do
87
87
  out, err = capture_io do
88
88
  Dir.chdir fixture_path(:really_good)
89
- @command.run
89
+ @command.run()
90
90
  end
91
91
  refute out.empty?, "there should be some output"
92
92
  assert err.empty?, "there should be no errors"
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
2
 
3
3
  #
4
4
  # These format tests also broke things in the regular testsuite.
@@ -20,13 +20,13 @@ describe ::Inch::CLI::Command::List do
20
20
  end
21
21
 
22
22
  it "should run with --no-private switch" do
23
- out = `#{@command} --format json`
23
+ out = %x|#{@command} --format json|
24
24
  refute out.empty?, "there should be some output"
25
25
  assert_parsed_output JSON[out]
26
26
  end
27
27
 
28
28
  it "should run with --no-protected switch" do
29
- out = `#{@command} --format yaml`
29
+ out = %x|#{@command} --format yaml|
30
30
  refute out.empty?, "there should be some output"
31
31
  assert_parsed_output YAML.load(out)
32
32
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
2
 
3
3
  describe ::Inch::CLI::Command do
4
4
  before do
@@ -7,7 +7,7 @@ describe ::Inch::CLI::Command do
7
7
  end
8
8
 
9
9
  it "should run without visibility switches" do
10
- out, _err = capture_io do
10
+ out, err = capture_io do
11
11
  @command.run("--all")
12
12
  end
13
13
  refute out.empty?, "there should be some output"
@@ -18,7 +18,7 @@ describe ::Inch::CLI::Command do
18
18
  end
19
19
 
20
20
  it "should run with --no-protected switch" do
21
- out, _err = capture_io do
21
+ out, err = capture_io do
22
22
  @command.run("--all", "--no-protected")
23
23
  end
24
24
  refute out.empty?, "there should be some output"
@@ -29,8 +29,8 @@ describe ::Inch::CLI::Command do
29
29
  end
30
30
 
31
31
  it "should run with --no-public switch" do
32
- out, _err = capture_io do
33
- @command.run(*%w(--all --no-public))
32
+ out, err = capture_io do
33
+ @command.run(*%w|--all --no-public|)
34
34
  end
35
35
  refute out.empty?, "there should be some output"
36
36
  refute_match /\bFoo#public_method\b/, out
@@ -40,8 +40,8 @@ describe ::Inch::CLI::Command do
40
40
  end
41
41
 
42
42
  it "should run with --no-public --no-protected switch" do
43
- out, _err = capture_io do
44
- @command.run(*%w(--all --no-public --no-protected))
43
+ out, err = capture_io do
44
+ @command.run(*%w|--all --no-public --no-protected|)
45
45
  end
46
46
  assert out.empty?, "there should be no output"
47
47
  refute_match /\bFoo#public_method\b/, out
@@ -51,8 +51,8 @@ describe ::Inch::CLI::Command do
51
51
  end
52
52
 
53
53
  it "should run with --no-public --no-protected --private switch" do
54
- out, _err = capture_io do
55
- @command.run(*%w(--all --no-public --no-protected --private))
54
+ out, err = capture_io do
55
+ @command.run(*%w|--all --no-public --no-protected --private|)
56
56
  end
57
57
  refute out.empty?, "there should be some output"
58
58
  refute_match /\bFoo#public_method\b/, out
@@ -62,8 +62,8 @@ describe ::Inch::CLI::Command do
62
62
  end
63
63
 
64
64
  it "should run with --no-public switch" do
65
- out, _err = capture_io do
66
- @command.run(*%w(--all --no-public))
65
+ out, err = capture_io do
66
+ @command.run(*%w|--all --no-public|)
67
67
  end
68
68
  refute out.empty?, "there should be some output"
69
69
  refute_match /\bFoo#public_method\b/, out
@@ -73,8 +73,8 @@ describe ::Inch::CLI::Command do
73
73
  end
74
74
 
75
75
  it "should run with --no-protected switch" do
76
- out, _err = capture_io do
77
- @command.run(*%w(--all --no-protected))
76
+ out, err = capture_io do
77
+ @command.run(*%w|--all --no-protected|)
78
78
  end
79
79
  refute out.empty?, "there should be some output"
80
80
  assert_match /\bFoo#public_method\b/, out
@@ -3,10 +3,8 @@ module Shared
3
3
  extend Minitest::Spec::DSL
4
4
 
5
5
  it "should give error when run with --unknown-switch" do
6
- _out, _err = capture_io do
7
- assert_raises(SystemExit) do
8
- @command.run("lib/foo.rb", "--unknown-switch")
9
- end
6
+ out, err = capture_io do
7
+ assert_raises(SystemExit) { @command.run("lib/foo.rb", "--unknown-switch") }
10
8
  end
11
9
  end
12
10
 
@@ -45,6 +43,7 @@ module Shared
45
43
  assert_match /\bFoo::Bar#/, out
46
44
  end
47
45
 
46
+
48
47
  it "should run with --only-undocumented switch" do
49
48
  skip
50
49
  out, err = capture_io do
@@ -1,12 +1,12 @@
1
- require "simplecov"
1
+ require 'simplecov'
2
2
 
3
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
 
5
- require "minitest/autorun"
6
- require "bundler"
5
+ require 'minitest/autorun'
6
+ require 'bundler'
7
7
  Bundler.require
8
- require "inch"
9
- require "inch/cli"
8
+ require 'inch'
9
+ require 'inch/cli'
10
10
 
11
11
  def assert_roles(object, expected, unexpected)
12
12
  roles = object.roles.map(&:class)
@@ -18,16 +18,6 @@ def assert_roles(object, expected, unexpected)
18
18
  end
19
19
  end
20
20
 
21
- def count_roles(object, role_class, object_name = nil)
22
- find_roles(object, role_class, object_name).size
23
- end
24
-
25
- def find_roles(object, role_class, object_name = nil)
26
- object.roles.select do |r|
27
- r.class == role_class && (object_name.nil? || r.object.name == object_name)
28
- end
29
- end
30
-
31
21
  def fixture_path(name)
32
22
  File.join(File.dirname(__FILE__), "fixtures", name.to_s)
33
23
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  describe ::Inch::API::Filter do
4
4
  before do
@@ -13,37 +13,37 @@ describe ::Inch::API::Filter do
13
13
  end
14
14
 
15
15
  it "should work with option: visibility == :public" do
16
- @options = { visibility: [:public] }
16
+ @options = {:visibility => [:public]}
17
17
  @context = ::Inch::API::Filter.new @codebase, @options
18
18
  assert @context.objects.all? { |o| o.public? }
19
19
  end
20
20
 
21
21
  it "should work with option: visibility == :protected" do
22
- @options = { visibility: [:protected] }
22
+ @options = {:visibility => [:protected]}
23
23
  @context = ::Inch::API::Filter.new @codebase, @options
24
24
  assert @context.objects.all? { |o| o.protected? }
25
25
  end
26
26
 
27
27
  it "should work with option: visibility == :private" do
28
- @options = { visibility: [:private] }
28
+ @options = {:visibility => [:private]}
29
29
  @context = ::Inch::API::Filter.new @codebase, @options
30
30
  assert @context.objects.all? { |o| o.private? || o.tagged_as_private? }
31
31
  end
32
32
 
33
33
  it "should work with option: namespaces == :only" do
34
- @options = { namespaces: :only }
34
+ @options = {:namespaces => :only}
35
35
  @context = ::Inch::API::Filter.new @codebase, @options
36
36
  assert @context.objects.all? { |o| o.namespace? }
37
37
  end
38
38
 
39
39
  it "should work with option: undocumented == :only" do
40
- @options = { undocumented: :only }
40
+ @options = {:undocumented => :only}
41
41
  @context = ::Inch::API::Filter.new @codebase, @options
42
42
  assert @context.objects.all? { |o| o.undocumented? }
43
43
  end
44
44
 
45
45
  it "should work with option: depth == 2" do
46
- @options = { depth: 2 }
46
+ @options = {:depth => 2}
47
47
  @context = ::Inch::API::Filter.new @codebase, @options
48
48
  refute @context.objects.any? { |o| o.depth > 2 }
49
49
  end