inch 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +15 -0
- data/.rubocop_todo.yml +113 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +5 -2
- data/README.md +2 -2
- data/Rakefile +2 -2
- data/bin/inch +3 -2
- data/config/defaults.rb +7 -0
- data/inch.gemspec +7 -7
- data/lib/inch.rb +9 -10
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +2 -3
- data/lib/inch/api/compare/codebases.rb +1 -1
- data/lib/inch/api/diff.rb +6 -9
- data/lib/inch/api/options/base.rb +4 -4
- data/lib/inch/api/options/suggest.rb +1 -1
- data/lib/inch/api/stats.rb +0 -1
- data/lib/inch/api/suggest.rb +8 -9
- data/lib/inch/cli.rb +6 -6
- data/lib/inch/cli/command.rb +15 -15
- data/lib/inch/cli/command/base.rb +2 -2
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +7 -8
- data/lib/inch/cli/command/inspect.rb +5 -4
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +8 -8
- data/lib/inch/cli/command/options/base_list.rb +9 -5
- data/lib/inch/cli/command/options/console.rb +4 -3
- data/lib/inch/cli/command/options/diff.rb +6 -4
- data/lib/inch/cli/command/options/inspect.rb +2 -2
- data/lib/inch/cli/command/options/list.rb +4 -3
- data/lib/inch/cli/command/options/show.rb +2 -2
- data/lib/inch/cli/command/options/stats.rb +2 -1
- data/lib/inch/cli/command/options/suggest.rb +6 -3
- data/lib/inch/cli/command/output/base.rb +2 -4
- data/lib/inch/cli/command/output/console.rb +4 -5
- data/lib/inch/cli/command/output/diff.rb +6 -6
- data/lib/inch/cli/command/output/inspect.rb +6 -8
- data/lib/inch/cli/command/output/list.rb +0 -1
- data/lib/inch/cli/command/output/show.rb +4 -5
- data/lib/inch/cli/command/output/stats.rb +21 -21
- data/lib/inch/cli/command/output/suggest.rb +28 -26
- data/lib/inch/cli/command/show.rb +4 -4
- data/lib/inch/cli/command/stats.rb +4 -4
- data/lib/inch/cli/command/suggest.rb +6 -6
- data/lib/inch/cli/command_parser.rb +6 -5
- data/lib/inch/cli/sparkline_helper.rb +2 -2
- data/lib/inch/cli/trace_helper.rb +1 -1
- data/lib/inch/cli/yardopts_helper.rb +4 -3
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/converter.rb +6 -8
- data/lib/inch/code_object/provider.rb +1 -1
- data/lib/inch/code_object/provider/yard.rb +10 -12
- data/lib/inch/code_object/provider/yard/docstring.rb +53 -21
- data/lib/inch/code_object/provider/yard/nodoc_helper.rb +3 -3
- data/lib/inch/code_object/provider/yard/object.rb +11 -9
- data/lib/inch/code_object/provider/yard/object/base.rb +33 -9
- data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +12 -0
- data/lib/inch/code_object/provider/yard/object/method_object.rb +36 -11
- data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +2 -2
- data/lib/inch/code_object/provider/yard/object/method_signature.rb +11 -8
- data/lib/inch/code_object/provider/yard/object/namespace_object.rb +1 -4
- data/lib/inch/code_object/provider/yard/parser.rb +2 -2
- data/lib/inch/code_object/proxy.rb +10 -9
- data/lib/inch/code_object/proxy/base.rb +8 -8
- data/lib/inch/code_object/proxy/class_variable_object.rb +8 -0
- data/lib/inch/code_object/proxy/method_object.rb +3 -2
- data/lib/inch/code_object/proxy/method_parameter_object.rb +1 -1
- data/lib/inch/codebase.rb +4 -5
- data/lib/inch/codebase/objects_filter.rb +2 -4
- data/lib/inch/codebase/serializer.rb +3 -3
- data/lib/inch/config.rb +2 -2
- data/lib/inch/config/base.rb +0 -1
- data/lib/inch/config/codebase.rb +3 -3
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +16 -15
- data/lib/inch/evaluation/grade_list.rb +2 -2
- data/lib/inch/evaluation/object_schema.rb +1 -1
- data/lib/inch/evaluation/proxy.rb +8 -7
- data/lib/inch/evaluation/proxy/base.rb +12 -7
- data/lib/inch/evaluation/proxy/class_variable_object.rb +19 -0
- data/lib/inch/evaluation/proxy/constant_object.rb +1 -1
- data/lib/inch/evaluation/proxy/method_object.rb +12 -5
- data/lib/inch/evaluation/proxy/module_object.rb +1 -1
- data/lib/inch/evaluation/proxy/namespace_object.rb +1 -1
- data/lib/inch/evaluation/role/base.rb +1 -1
- data/lib/inch/evaluation/role/class_variable.rb +55 -0
- data/lib/inch/evaluation/role/method.rb +0 -1
- data/lib/inch/evaluation/role/method_parameter.rb +2 -1
- data/lib/inch/evaluation/role/object.rb +2 -2
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +2 -2
- data/lib/inch/utils/shell_helper.rb +1 -1
- data/lib/inch/utils/ui.rb +5 -5
- data/lib/inch/utils/weighted_list.rb +2 -3
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/simple/lib/broken.rb +35 -7
- data/test/fixtures/simple/lib/broken_ruby_2_0_features.rb +7 -0
- data/test/fixtures/simple/lib/directives.rb +8 -0
- data/test/fixtures/simple/lib/foo.rb +17 -0
- data/test/integration/api/compare/codebases.rb +1 -1
- data/test/integration/cli/command/console_test.rb +5 -5
- data/test/integration/cli/command/inspect_test.rb +4 -5
- data/test/integration/cli/command/list_test.rb +3 -4
- data/test/integration/cli/command/show_test.rb +4 -4
- data/test/integration/cli/command/stats_test.rb +2 -2
- data/test/integration/cli/command/suggest_test.rb +7 -7
- data/test/integration/stats_options_test.rb +3 -3
- data/test/integration/visibility_options_test.rb +13 -13
- data/test/shared/base_list.rb +4 -3
- data/test/test_helper.rb +16 -5
- data/test/unit/api/filter_test.rb +7 -7
- data/test/unit/api/get_test.rb +1 -1
- data/test/unit/api/list_test.rb +1 -1
- data/test/unit/api/options/base_test.rb +3 -3
- data/test/unit/api/stats_test.rb +1 -1
- data/test/unit/api/suggest_test.rb +3 -3
- data/test/unit/cli/arguments_test.rb +1 -1
- data/test/unit/cli/command/base_test.rb +1 -1
- data/test/unit/cli/command/options/base_list_test.rb +2 -2
- data/test/unit/cli/command/options/base_object_test.rb +1 -1
- data/test/unit/cli/command/options/base_test.rb +1 -1
- data/test/unit/cli/command_parser_test.rb +2 -2
- data/test/unit/cli/trace_helper_test.rb +1 -1
- data/test/unit/cli/yardopts_helper_test.rb +4 -3
- data/test/unit/code_object/converter_test.rb +1 -1
- data/test/unit/code_object/provider/yard/docstring_test.rb +105 -28
- data/test/unit/code_object/provider/yard/nodoc_helper_test.rb +5 -5
- data/test/unit/code_object/provider/yard/object/method_object_test.rb +20 -10
- data/test/unit/code_object/provider/yard_test.rb +4 -4
- data/test/unit/code_object/provider_test.rb +1 -1
- data/test/unit/code_object/proxy/method_object_test.rb +366 -262
- data/test/unit/code_object/proxy_test.rb +1 -1
- data/test/unit/codebase/objects_test.rb +2 -2
- data/test/unit/codebase/proxy_test.rb +1 -1
- data/test/unit/config/codebase_test.rb +1 -1
- data/test/unit/evaluation/role/base_test.rb +1 -1
- data/test/unit/utils/ui_test.rb +4 -4
- data/test/unit/utils/weighted_list_test.rb +7 -4
- metadata +12 -2
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
2
|
-
require File.expand_path(File.dirname(__FILE__) +
|
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,4 +62,3 @@ 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__) +
|
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,
|
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,
|
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__) +
|
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__) +
|
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,7 +8,7 @@ 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"
|
@@ -37,13 +37,13 @@ describe ::Inch::CLI::Command::Suggest do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should run with non-existing filelist in args" do
|
40
|
-
|
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
|
@@ -58,7 +58,7 @@ describe ::Inch::CLI::Command::Suggest do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should give error when run with --unknown-switch" do
|
61
|
-
|
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__) +
|
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 =
|
23
|
+
out = `#{@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 =
|
29
|
+
out = `#{@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__) +
|
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,
|
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,
|
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,
|
33
|
-
@command.run(*%w
|
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,
|
44
|
-
@command.run(*%w
|
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,
|
55
|
-
@command.run(*%w
|
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,
|
66
|
-
@command.run(*%w
|
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,
|
77
|
-
@command.run(*%w
|
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
|
data/test/shared/base_list.rb
CHANGED
@@ -3,8 +3,10 @@ module Shared
|
|
3
3
|
extend Minitest::Spec::DSL
|
4
4
|
|
5
5
|
it "should give error when run with --unknown-switch" do
|
6
|
-
|
7
|
-
assert_raises(SystemExit)
|
6
|
+
_out, _err = capture_io do
|
7
|
+
assert_raises(SystemExit) do
|
8
|
+
@command.run("lib/foo.rb", "--unknown-switch")
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
@@ -43,7 +45,6 @@ module Shared
|
|
43
45
|
assert_match /\bFoo::Bar#/, out
|
44
46
|
end
|
45
47
|
|
46
|
-
|
47
48
|
it "should run with --only-undocumented switch" do
|
48
49
|
skip
|
49
50
|
out, err = capture_io do
|
data/test/test_helper.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
require
|
1
|
+
require "simplecov"
|
2
2
|
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "minitest/autorun"
|
6
|
+
require "bundler"
|
7
7
|
Bundler.require
|
8
|
-
require
|
8
|
+
require "inch"
|
9
|
+
require "inch/cli"
|
9
10
|
|
10
11
|
def assert_roles(object, expected, unexpected)
|
11
12
|
roles = object.roles.map(&:class)
|
@@ -17,6 +18,16 @@ def assert_roles(object, expected, unexpected)
|
|
17
18
|
end
|
18
19
|
end
|
19
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
|
+
|
20
31
|
def fixture_path(name)
|
21
32
|
File.join(File.dirname(__FILE__), "fixtures", name.to_s)
|
22
33
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
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 = {:
|
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 = {:
|
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 = {:
|
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 = {:
|
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 = {:
|
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 = {:
|
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
|
data/test/unit/api/get_test.rb
CHANGED
data/test/unit/api/list_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
|
2
2
|
|
3
3
|
describe ::Inch::API::Options::Base do
|
4
4
|
class APIOptionsTest < ::Inch::API::Options::Base
|
@@ -8,7 +8,7 @@ describe ::Inch::API::Options::Base do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should work with a Hash or Struct" do
|
11
|
-
@options_hash = {:
|
11
|
+
@options_hash = { foo: "foo", baz: 42 }
|
12
12
|
@options_struct = OpenStruct.new(@options_hash)
|
13
13
|
|
14
14
|
@options1 = APIOptionsTest.new @options_hash
|
@@ -21,7 +21,7 @@ describe ::Inch::API::Options::Base do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should return default values" do
|
24
|
-
@options_hash = {:
|
24
|
+
@options_hash = { baz: 42 }
|
25
25
|
@options = APIOptionsTest.new @options_hash
|
26
26
|
|
27
27
|
assert_equal :bar, @options.foo
|
data/test/unit/api/stats_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
2
|
|
3
3
|
describe ::Inch::API::Suggest do
|
4
4
|
before do
|
@@ -13,10 +13,10 @@ describe ::Inch::API::Suggest do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should work with option: object_count" do
|
16
|
-
@options = {:
|
16
|
+
@options = { object_count: 10 }
|
17
17
|
@context = ::Inch::API::Suggest.new @codebase, @options
|
18
18
|
|
19
|
-
@options2 = {:
|
19
|
+
@options2 = { object_count: 20 }
|
20
20
|
@context2 = ::Inch::API::Suggest.new @codebase, @options2
|
21
21
|
|
22
22
|
assert_equal 10, @context.objects.size
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../../test_helper")
|
2
2
|
|
3
3
|
describe ::Inch::CLI::Command::Options::BaseList do
|
4
4
|
it "should run parse without errors" do
|
@@ -10,7 +10,7 @@ describe ::Inch::CLI::Command::Options::BaseList do
|
|
10
10
|
assert @options.undocumented.nil?
|
11
11
|
assert @options.depth.nil?
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "should run parse twice without affecting the second run" do
|
15
15
|
@options = ::Inch::CLI::Command::Options::BaseList.new
|
16
16
|
@options.parse(["--no-public", "--no-protected", "--private"])
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
2
|
|
3
3
|
describe ::Inch::CLI::CommandParser do
|
4
4
|
before do
|
@@ -8,7 +8,7 @@ describe ::Inch::CLI::CommandParser do
|
|
8
8
|
|
9
9
|
it "should run without args" do
|
10
10
|
out, err = capture_io do
|
11
|
-
@command = @command_parser.run
|
11
|
+
@command = @command_parser.run
|
12
12
|
end
|
13
13
|
refute out.empty?, "there should be some output"
|
14
14
|
assert err.empty?, "there should be no errors"
|