yardstick 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.rspec +4 -0
  4. data/.ruby-gemset +1 -0
  5. data/.travis.yml +11 -16
  6. data/CONTRIBUTING.md +11 -0
  7. data/Gemfile +3 -59
  8. data/Gemfile.devtools +54 -0
  9. data/Guardfile +32 -0
  10. data/LICENSE +1 -1
  11. data/README.md +71 -55
  12. data/Rakefile +2 -7
  13. data/TODO +12 -0
  14. data/bin/yardstick +1 -0
  15. data/config/devtools.yml +2 -0
  16. data/config/flay.yml +2 -2
  17. data/config/flog.yml +1 -1
  18. data/config/mutant.yml +3 -0
  19. data/config/{site.reek → reek.yml} +31 -25
  20. data/config/rubocop.yml +49 -0
  21. data/config/yardstick.yml +31 -0
  22. data/lib/yardstick.rb +35 -15
  23. data/lib/yardstick/cli.rb +7 -7
  24. data/lib/yardstick/config.rb +176 -0
  25. data/lib/yardstick/document.rb +215 -0
  26. data/lib/yardstick/document_set.rb +21 -0
  27. data/lib/yardstick/measurement.rb +18 -145
  28. data/lib/yardstick/measurement_set.rb +2 -2
  29. data/lib/yardstick/parser.rb +61 -0
  30. data/lib/yardstick/processor.rb +21 -35
  31. data/lib/yardstick/rake/measurement.rb +7 -49
  32. data/lib/yardstick/rake/verify.rb +28 -55
  33. data/lib/yardstick/report_output.rb +57 -0
  34. data/lib/yardstick/rule.rb +64 -37
  35. data/lib/yardstick/rule_config.rb +56 -0
  36. data/lib/yardstick/rules/api_tag.rb +95 -0
  37. data/lib/yardstick/rules/example_tag.rb +33 -0
  38. data/lib/yardstick/rules/return_tag.rb +21 -0
  39. data/lib/yardstick/rules/summary.rb +87 -0
  40. data/lib/yardstick/version.rb +1 -1
  41. data/lib/yardstick/yard_ext.rb +1 -6
  42. data/spec/integration/yardstick/class_methods/measure_spec.rb +22 -0
  43. data/spec/integration/yardstick/class_methods/measure_string_spec.rb +20 -0
  44. data/spec/integration/yardstick/document/file_spec.rb +16 -0
  45. data/spec/integration/yardstick/document/line_spec.rb +25 -0
  46. data/spec/integration/yardstick/document/path_spec.rb +45 -0
  47. data/spec/integration/yardstick/processor/process_string_spec.rb +401 -0
  48. data/spec/integration/yardstick/rake/measurement_spec.rb +22 -0
  49. data/spec/integration/yardstick/rake/verify_spec.rb +19 -0
  50. data/spec/shared/measured_itself_behavior.rb +15 -0
  51. data/spec/spec_helper.rb +13 -26
  52. data/spec/support/document_mock.rb +16 -0
  53. data/spec/support/rules.rb +51 -0
  54. data/spec/unit/yardstick/class_methods/measure_spec.rb +31 -0
  55. data/spec/unit/yardstick/class_methods/measure_string_spec.rb +33 -0
  56. data/spec/unit/yardstick/cli_spec.rb +11 -8
  57. data/spec/unit/yardstick/config/class_methods/coerce_spec.rb +32 -0
  58. data/spec/unit/yardstick/config/for_rule_spec.rb +47 -0
  59. data/spec/unit/yardstick/config/initialize_spec.rb +21 -0
  60. data/spec/unit/yardstick/config/output_spec.rb +15 -0
  61. data/spec/unit/yardstick/config/output_writer_spec.rb +20 -0
  62. data/spec/unit/yardstick/config/path_spec.rb +13 -0
  63. data/spec/unit/yardstick/config/path_writer_spec.rb +11 -0
  64. data/spec/unit/yardstick/config/require_exact_threshold_predicate_spec.rb +19 -0
  65. data/spec/unit/yardstick/config/require_exact_threshold_writer_spec.rb +19 -0
  66. data/spec/unit/yardstick/config/set_defaults_spec.rb +42 -0
  67. data/spec/unit/yardstick/config/threshold_writer_spec.rb +15 -0
  68. data/spec/unit/yardstick/config/verbose_predicate_spec.rb +19 -0
  69. data/spec/unit/yardstick/config/verbose_writer_spec.rb +19 -0
  70. data/spec/unit/yardstick/document/api_predicate_spec.rb +25 -0
  71. data/spec/unit/yardstick/document/class_methods/measure_spec.rb +25 -0
  72. data/spec/unit/yardstick/document/class_methods/register_rule_spec.rb +19 -0
  73. data/spec/unit/yardstick/document/class_methods/registered_rules_spec.rb +9 -0
  74. data/spec/unit/yardstick/document/docstring_spec.rb +11 -0
  75. data/spec/unit/yardstick/document/file_spec.rb +14 -0
  76. data/spec/unit/yardstick/document/has_tag_predicate_spec.rb +15 -0
  77. data/spec/unit/yardstick/document/line_spec.rb +12 -0
  78. data/spec/unit/yardstick/document/null_tag/text_spec.rb +9 -0
  79. data/spec/unit/yardstick/document/null_tag/types_spec.rb +9 -0
  80. data/spec/unit/yardstick/document/path_spec.rb +12 -0
  81. data/spec/unit/yardstick/document/summary_text_spec.rb +23 -0
  82. data/spec/unit/yardstick/document/tag_text_spec.rb +17 -0
  83. data/spec/unit/yardstick/document/tag_types_spec.rb +18 -0
  84. data/spec/unit/yardstick/document/visibility_spec.rb +22 -0
  85. data/spec/unit/yardstick/document_set/measure_spec.rb +28 -0
  86. data/spec/unit/yardstick/measurement/description_spec.rb +12 -0
  87. data/spec/unit/yardstick/measurement/initialize_spec.rb +12 -0
  88. data/spec/unit/yardstick/measurement/ok_predicate_spec.rb +21 -0
  89. data/spec/unit/yardstick/measurement/puts_spec.rb +62 -0
  90. data/spec/unit/yardstick/measurement/skip_predicate_spec.rb +27 -0
  91. data/spec/unit/yardstick/measurement_set/coverage_spec.rb +23 -0
  92. data/spec/unit/yardstick/measurement_set/failed_spec.rb +28 -0
  93. data/spec/unit/yardstick/measurement_set/initialize_spec.rb +27 -0
  94. data/spec/unit/yardstick/measurement_set/puts_spec.rb +63 -0
  95. data/spec/unit/yardstick/measurement_set/successful_spec.rb +13 -0
  96. data/spec/unit/yardstick/measurement_set/total_spec.rb +12 -0
  97. data/spec/unit/yardstick/ordered_set/each_spec.rb +18 -0
  98. data/spec/unit/yardstick/ordered_set/empty_predicate_spec.rb +19 -0
  99. data/spec/unit/yardstick/ordered_set/include_predicate_spec.rb +21 -0
  100. data/spec/unit/yardstick/ordered_set/index_spec.rb +21 -0
  101. data/spec/unit/yardstick/ordered_set/left_shift_operator_spec.rb +16 -0
  102. data/spec/unit/yardstick/ordered_set/length_spec.rb +11 -0
  103. data/spec/unit/yardstick/ordered_set/merge_spec.rb +16 -0
  104. data/spec/unit/yardstick/parser/class_methods/parse_paths_spec.rb +28 -0
  105. data/spec/unit/yardstick/parser/class_methods/parse_string_spec.rb +28 -0
  106. data/spec/unit/yardstick/processor/process_spec.rb +17 -0
  107. data/spec/unit/yardstick/processor/process_string_spec.rb +17 -0
  108. data/spec/unit/yardstick/rake/measurement/initialize_spec.rb +64 -0
  109. data/spec/unit/yardstick/rake/measurement/yardstick_measure_spec.rb +22 -0
  110. data/spec/unit/yardstick/rake/verify/initialize_spec.rb +72 -0
  111. data/spec/unit/yardstick/rake/verify/verify_measurements_spec.rb +85 -0
  112. data/spec/unit/yardstick/report_output/class_methods/coerce_spec.rb +18 -0
  113. data/spec/unit/yardstick/report_output/initialize_spec.rb +11 -0
  114. data/spec/unit/yardstick/report_output/to_s_spec.rb +12 -0
  115. data/spec/unit/yardstick/report_output/write_spec.rb +31 -0
  116. data/spec/unit/yardstick/round_percentage_spec.rb +9 -0
  117. data/spec/unit/yardstick/rule/class_methods/coerce_spec.rb +21 -0
  118. data/spec/unit/yardstick/rule/class_methods/inherited_spec.rb +15 -0
  119. data/spec/unit/yardstick/rule/enabled_predicate_spec.rb +18 -0
  120. data/spec/unit/yardstick/rule/initialize_spec.rb +25 -0
  121. data/spec/unit/yardstick/rule/validatable_predicate_spec.rb +11 -0
  122. data/spec/unit/yardstick/rule_config/enabled_for_path_predicate_spec.rb +41 -0
  123. data/spec/unit/yardstick/rule_config/initialize_spec.rb +16 -0
  124. data/spec/unit/yardstick/rules/api_tag/inclusion/valid_predicate_spec.rb +27 -0
  125. data/spec/unit/yardstick/rules/api_tag/presence/valid_predicate_spec.rb +25 -0
  126. data/spec/unit/yardstick/rules/api_tag/private_method/valid_predicate_spec.rb +21 -0
  127. data/spec/unit/yardstick/rules/api_tag/private_method/validatable_predicate_spec.rb +21 -0
  128. data/spec/unit/yardstick/rules/api_tag/protected_method/valid_predicate_spec.rb +25 -0
  129. data/spec/unit/yardstick/rules/api_tag/protected_method/validatable_predicate_spec.rb +21 -0
  130. data/spec/unit/yardstick/rules/example_tag/valid_predicate_spec.rb +25 -0
  131. data/spec/unit/yardstick/rules/example_tag/validatable_predicate_spec.rb +32 -0
  132. data/spec/unit/yardstick/rules/return_tag/valid_predicate_spec.rb +21 -0
  133. data/spec/unit/yardstick/rules/summary/delimiter/valid_predicate_spec.rb +21 -0
  134. data/spec/unit/yardstick/rules/summary/length/valid_predicate_spec.rb +27 -0
  135. data/spec/unit/yardstick/rules/summary/presence/valid_predicate_spec.rb +21 -0
  136. data/spec/unit/yardstick/rules/summary/presence/validatable_predicate_spec.rb +21 -0
  137. data/spec/unit/yardstick/rules/summary/single_line/valid_predicate_spec.rb +21 -0
  138. data/yardstick.gemspec +7 -11
  139. metadata +222 -65
  140. data/.rvmrc +0 -1
  141. data/lib/yardstick/measurable.rb +0 -67
  142. data/lib/yardstick/method.rb +0 -113
  143. data/lib/yardstick/rule_set.rb +0 -22
  144. data/spec/support/config_alias.rb +0 -5
  145. data/spec/unit/yardstick/measurement_set_spec.rb +0 -266
  146. data/spec/unit/yardstick/measurement_spec.rb +0 -257
  147. data/spec/unit/yardstick/method_spec.rb +0 -357
  148. data/spec/unit/yardstick/rake/measurement_spec.rb +0 -175
  149. data/spec/unit/yardstick/rake/verify_spec.rb +0 -231
  150. data/spec/unit/yardstick/rule_spec.rb +0 -36
  151. data/spec/unit/yardstick_spec.rb +0 -71
  152. data/tasks/metrics/ci.rake +0 -9
  153. data/tasks/metrics/flay.rake +0 -53
  154. data/tasks/metrics/flog.rake +0 -44
  155. data/tasks/metrics/heckle.rake +0 -52
  156. data/tasks/metrics/metric_fu.rake +0 -31
  157. data/tasks/metrics/reek.rake +0 -21
  158. data/tasks/metrics/roodi.rake +0 -19
  159. data/tasks/metrics/yardstick.rake +0 -27
  160. data/tasks/spec.rake +0 -64
  161. data/tasks/yard.rake +0 -11
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Config, '#output=' do
6
+ subject { config.output = output }
7
+
8
+ let(:config) { described_class.new }
9
+ let(:path) { 'tmp/*.rb' }
10
+
11
+ before { config.output = path }
12
+
13
+ context 'output' do
14
+ subject { config.output }
15
+
16
+ it { should be_a(Yardstick::ReportOutput) }
17
+
18
+ its(:to_s) { should == 'tmp/*.rb' }
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Config, '#path' do
6
+ subject { described_class.new(options).path }
7
+
8
+ context 'when default options' do
9
+ let(:options) { {} }
10
+
11
+ it { should == 'lib/**/*.rb' }
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Config, '#path=' do
6
+ subject { described_class.new }
7
+
8
+ before { subject.path = '/tmp/*.rb' }
9
+
10
+ its(:path) { should == '/tmp/*.rb' }
11
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Config, '#require_exact_threshold?' do
6
+ subject { described_class.new(config).require_exact_threshold? }
7
+
8
+ context 'when set to true' do
9
+ let(:config) { { require_exact_threshold: true } }
10
+
11
+ it { should be(true) }
12
+ end
13
+
14
+ context 'when set to false' do
15
+ let(:config) { { require_exact_threshold: false } }
16
+
17
+ it { should be(false) }
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Config, '#require_exact_threshold=' do
6
+ subject { described_class.new }
7
+
8
+ context 'when argument is true' do
9
+ before { subject.require_exact_threshold = true }
10
+
11
+ its(:require_exact_threshold?) { should be(true) }
12
+ end
13
+
14
+ context 'when argument is false' do
15
+ before { subject.require_exact_threshold = false }
16
+
17
+ its(:require_exact_threshold?) { should be(false) }
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Config, '#set_defaults' do
6
+ subject { described_class.new(options) }
7
+
8
+ context 'when without options' do
9
+ let(:options) { {} }
10
+
11
+ its(:threshold) { should be(100) }
12
+
13
+ its(:verbose?) { should be(true) }
14
+
15
+ its(:path) { should eq('lib/**/*.rb') }
16
+
17
+ its(:require_exact_threshold?) { should be(true) }
18
+
19
+ it 'sets rules to empty hash' do
20
+ expect(subject.instance_variable_get(:@rules)).to eq({})
21
+ end
22
+ end
23
+
24
+ context 'when with options' do
25
+ let(:options) do
26
+ {
27
+ threshold: 15,
28
+ verbose: false,
29
+ path: 'tmp/*.rb',
30
+ require_exact_threshold: false
31
+ }
32
+ end
33
+
34
+ its(:threshold) { should be(15) }
35
+
36
+ its(:verbose?) { should be(false) }
37
+
38
+ its(:path) { should eq('tmp/*.rb') }
39
+
40
+ its(:require_exact_threshold?) { should be(false) }
41
+ end
42
+ end
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Config, '#threshold=' do
6
+ subject { described_class.new }
7
+
8
+ let(:new_threshold) { 34 }
9
+
10
+ before do
11
+ subject.threshold = new_threshold
12
+ end
13
+
14
+ its(:threshold) { should be(new_threshold) }
15
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Config, '#verbose?' do
6
+ subject { described_class.new(config).verbose? }
7
+
8
+ context 'when set to true' do
9
+ let(:config) { { verbose: true } }
10
+
11
+ it { should be(true) }
12
+ end
13
+
14
+ context 'when set to false' do
15
+ let(:config) { { verbose: false } }
16
+
17
+ it { should be(false) }
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Config, '#verbose=' do
6
+ subject { described_class.new }
7
+
8
+ context 'when argument is true' do
9
+ before { subject.verbose = true }
10
+
11
+ it { should be_verbose }
12
+ end
13
+
14
+ context 'when argument is false' do
15
+ before { subject.verbose = false }
16
+
17
+ it { should_not be_verbose }
18
+ end
19
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#api?' do
6
+ subject { described_class.new(docstring).api?(types) }
7
+
8
+ let(:docstring) { double('docstring') }
9
+
10
+ before do
11
+ docstring.stub(:tag).with('api') { double(text: 'private') }
12
+ end
13
+
14
+ context 'when tag is equal' do
15
+ let(:types) { ['private'] }
16
+
17
+ it { should be(true) }
18
+ end
19
+
20
+ context 'when tag is not equal' do
21
+ let(:types) { ['public'] }
22
+
23
+ it { should be(false) }
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '.measure' do
6
+ subject { described_class.measure(document, config) }
7
+
8
+ let(:config) { Yardstick::Config.new }
9
+ let(:document) { double('document') }
10
+
11
+ let(:registered_rules) do
12
+ described_class.instance_variable_get(:@registered_rules)
13
+ end
14
+
15
+ before do
16
+ registered_rules.each do |rule_class|
17
+ rule_class.should_receive(:coerce).with(document, config)
18
+ .and_return(ValidRule.new(document))
19
+ end
20
+ end
21
+
22
+ it { should be_a(Yardstick::MeasurementSet) }
23
+
24
+ its(:first) { should be_a(Yardstick::Measurement) }
25
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '.register_rule' do
6
+ subject { described_class.register_rule(rule_class) }
7
+
8
+ let(:rule_class) { Class.new }
9
+ let(:rule_classes) { described_class.registered_rules }
10
+
11
+ after do
12
+ rule_classes.delete(rule_class)
13
+ end
14
+
15
+ it 'adds rule_class to registered_rules' do
16
+ subject
17
+ expect(rule_classes).to include(rule_class)
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '.registered_rules' do
6
+ subject { described_class.registered_rules }
7
+
8
+ it { should_not be_empty }
9
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#docstring' do
6
+ subject { described_class.new(docstring).docstring }
7
+
8
+ let(:docstring) { double('docstring') }
9
+
10
+ it { should be(docstring) }
11
+ end
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#file' do
6
+ subject { described_class.new(docstring).file }
7
+
8
+ let(:docstring) { double('docstring', object: object) }
9
+ let(:object) { double('object', file: '/foo/bar.rb') }
10
+
11
+ it { should be_kind_of(Pathname) }
12
+
13
+ its(:to_s) { should == '/foo/bar.rb' }
14
+ end
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#has_tag?' do
6
+ subject { described_class.new(docstring).has_tag?(name) }
7
+
8
+ let(:docstring) { double('docstring') }
9
+ let(:name) { 'tag name' }
10
+
11
+ it 'delegates to docstring' do
12
+ docstring.should_receive(:has_tag?).with(name)
13
+ subject
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#line' do
6
+ subject { described_class.new(docstring).line }
7
+
8
+ let(:docstring) { double('docstring', object: object) }
9
+ let(:object) { double('object', line: 3) }
10
+
11
+ it { should be(3) }
12
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document::NullTag, '#text' do
6
+ subject { described_class.new.text }
7
+
8
+ it { should be_nil }
9
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document::NullTag, '#types' do
6
+ subject { described_class.new.types }
7
+
8
+ it { should eq([]) }
9
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#path' do
6
+ subject { described_class.new(docstring).path }
7
+
8
+ let(:docstring) { double('docstring', object: object) }
9
+ let(:object) { double('object', path: 'Foo#bar') }
10
+
11
+ it { should eq('Foo#bar') }
12
+ end
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#summary_text' do
6
+ subject { described_class.new(docstring).summary_text }
7
+
8
+ context 'when with summary' do
9
+ let(:docstring) do
10
+ "This is a method summary\n\nThis is a method body"
11
+ end
12
+
13
+ it { should eq('This is a method summary') }
14
+ end
15
+
16
+ context 'when without summary' do
17
+ let(:docstring) do
18
+ "\n\nThis is a method body"
19
+ end
20
+
21
+ it { should eq('') }
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#tag_text' do
6
+ subject { described_class.new(docstring).tag_text(name) }
7
+
8
+ let(:name) { 'api' }
9
+ let(:docstring) { double('docstring') }
10
+ let(:yard_tag) { double(text: 'private') }
11
+
12
+ before do
13
+ docstring.stub(:tag).with(name) { yard_tag }
14
+ end
15
+
16
+ it { should eq('private') }
17
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#tag_types' do
6
+ subject { described_class.new(docstring).tag_types(name) }
7
+
8
+ let(:name) { 'tag name' }
9
+ let(:docstring) { double('docstring') }
10
+ let(:yard_tag) { double(types: types) }
11
+ let(:types) { %w[type1 type2] }
12
+
13
+ before do
14
+ docstring.stub(:tag).with(name) { yard_tag }
15
+ end
16
+
17
+ it { should be(types) }
18
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Yardstick::Document, '#visibility' do
6
+ subject { described_class.new(docstring).visibility }
7
+
8
+ let(:docstring) { double('docstring', object: object) }
9
+ let(:object) { double('object', visibility: visibility) }
10
+
11
+ context 'when true' do
12
+ let(:visibility) { true }
13
+
14
+ it { should be(true) }
15
+ end
16
+
17
+ context 'when false' do
18
+ let(:visibility) { false }
19
+
20
+ it { should be(false) }
21
+ end
22
+ end