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
@@ -1,175 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
- require 'yardstick/rake/measurement'
5
-
6
- shared_examples_for 'set default name for measurement task' do
7
- it 'should set name to :yardstick_measure' do
8
- @task.instance_variable_get(:@name).should == :yardstick_measure
9
- end
10
- end
11
-
12
- shared_examples_for 'set default path for measurement task' do
13
- path = 'lib/**/*.rb'
14
-
15
- it "should set path to #{path.inspect}" do
16
- @task.instance_variable_get(:@path).should == path
17
- end
18
- end
19
-
20
- shared_examples_for 'set default output for measurement task' do
21
- it 'should set output to "measurements/report.txt"' do
22
- @task.instance_variable_get(:@output).should == @output
23
- end
24
- end
25
-
26
- shared_examples_for 'report writer' do
27
- it 'should write the report' do
28
- @task.path = 'lib/yardstick.rb' # speed up execution
29
- execute_action
30
- @output.read.should == "\nYARD-Coverage: 100.0% Success: 20 Failed: 0 Total: 20\n"
31
- end
32
- end
33
-
34
- describe Yardstick::Rake::Measurement do
35
- before do
36
- @output = Pathname('measurements/report.txt')
37
- @output.dirname.rmtree if @output.dirname.exist?
38
- end
39
-
40
- describe '.new' do
41
- describe 'with no arguments' do
42
- before do
43
- @task = Yardstick::Rake::Measurement.new
44
- end
45
-
46
- it 'should initialize a Measurement instance' do
47
- @task.should be_kind_of(Yardstick::Rake::Measurement)
48
- end
49
-
50
- it_should_behave_like 'set default name for measurement task'
51
- it_should_behave_like 'set default path for measurement task'
52
- it_should_behave_like 'set default output for measurement task'
53
-
54
- it 'should create a task named yardstick_measure' do
55
- Rake::Task['yardstick_measure'].should be_kind_of(Rake::Task)
56
- end
57
-
58
- it 'should include the path in the task name' do
59
- Rake.application.last_description.should == 'Measure docs in lib/**/*.rb with yardstick'
60
- end
61
-
62
- def execute_action
63
- Rake::Task['yardstick_measure'].execute
64
- end
65
-
66
- it_should_behave_like 'report writer'
67
- end
68
-
69
- describe 'with name provided' do
70
- before do
71
- @task = Yardstick::Rake::Measurement.new(:custom_task_name)
72
- end
73
-
74
- it 'should initialize a Measurement instance' do
75
- @task.should be_kind_of(Yardstick::Rake::Measurement)
76
- end
77
-
78
- it 'should set name to :custom_task_name' do
79
- @task.instance_variable_get(:@name).should == :custom_task_name
80
- end
81
-
82
- it_should_behave_like 'set default path for measurement task'
83
- it_should_behave_like 'set default output for measurement task'
84
-
85
- it 'should create a task named custom_task_name' do
86
- Rake::Task['custom_task_name'].should be_kind_of(Rake::Task)
87
- end
88
-
89
- it 'should include the path in the task name' do
90
- Rake.application.last_description.should == 'Measure docs in lib/**/*.rb with yardstick'
91
- end
92
-
93
- def execute_action
94
- Rake::Task['custom_task_name'].execute
95
- end
96
-
97
- it_should_behave_like 'report writer'
98
- end
99
-
100
- describe 'with block provided' do
101
- before do
102
- @task = Yardstick::Rake::Measurement.new do |*args|
103
- @yield = args
104
- end
105
- end
106
-
107
- it 'should initialize a Measurement instance' do
108
- @task.should be_kind_of(Yardstick::Rake::Measurement)
109
- end
110
-
111
- it_should_behave_like 'set default name for measurement task'
112
- it_should_behave_like 'set default path for measurement task'
113
- it_should_behave_like 'set default output for measurement task'
114
-
115
- it 'should yield to self' do
116
- @yield.should == [ @task ]
117
- @yield.first.should equal(@task)
118
- end
119
-
120
- it 'should create a task named yardstick_measure' do
121
- Rake::Task['yardstick_measure'].should be_kind_of(Rake::Task)
122
- end
123
-
124
- it 'should include the path in the task name' do
125
- Rake.application.last_description.should == 'Measure docs in lib/**/*.rb with yardstick'
126
- end
127
-
128
- def execute_action
129
- Rake::Task['yardstick_measure'].execute
130
- end
131
-
132
- it_should_behave_like 'report writer'
133
- end
134
- end
135
-
136
- describe '#path=' do
137
- before do
138
- @path = 'lib/yardstick.rb'
139
-
140
- @task = Yardstick::Rake::Measurement.new do |measurement|
141
- measurement.path = @path
142
- end
143
- end
144
-
145
- it 'should set path' do
146
- @task.instance_variable_get(:@path).should equal(@path)
147
- end
148
- end
149
-
150
- describe '#output=' do
151
- before do
152
- @task = Yardstick::Rake::Measurement.new do |measurement|
153
- measurement.output = @output
154
- end
155
- end
156
-
157
- it 'should set output' do
158
- @task.instance_variable_get(:@output).should eql(@output)
159
- end
160
- end
161
-
162
- describe '#yardstick_measure' do
163
- before do
164
- @task = Yardstick::Rake::Measurement.new do |task|
165
- task.output = @output
166
- end
167
- end
168
-
169
- def execute_action
170
- @task.yardstick_measure
171
- end
172
-
173
- it_should_behave_like 'report writer'
174
- end
175
- end
@@ -1,231 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
- require 'yardstick/rake/verify'
5
-
6
- shared_examples_for 'set default name for verify task' do
7
- it 'should set name to :verify_measurements' do
8
- @task.instance_variable_get(:@name).should == :verify_measurements
9
- end
10
- end
11
-
12
- shared_examples_for 'set default require_exact_threshold for verify task' do
13
- it 'should set require_exact_threshold to true' do
14
- @task.instance_variable_get(:@require_exact_threshold).should be_true
15
- end
16
- end
17
-
18
- shared_examples_for 'set default path for verify task' do
19
- path = 'lib/**/*.rb'
20
-
21
- it "should set path to #{path.inspect}" do
22
- @task.instance_variable_get(:@path).should == path
23
- end
24
- end
25
-
26
- shared_examples_for 'set default verbose for verify task' do
27
- it 'should set verbose to true' do
28
- @task.instance_variable_get(:@verbose).should be_true
29
- end
30
- end
31
-
32
- describe Yardstick::Rake::Verify do
33
- describe '.new' do
34
- describe 'with no arguments' do
35
- before do
36
- @task = Yardstick::Rake::Verify.new do |verify|
37
- verify.threshold = 100
38
- end
39
- end
40
-
41
- it 'should initialize a Verify instance' do
42
- @task.should be_kind_of(Yardstick::Rake::Verify)
43
- end
44
-
45
- it_should_behave_like 'set default name for verify task'
46
- it_should_behave_like 'set default require_exact_threshold for verify task'
47
- it_should_behave_like 'set default path for verify task'
48
- it_should_behave_like 'set default verbose for verify task'
49
-
50
- it 'should create a task named verify_measurements' do
51
- Rake::Task['verify_measurements'].should be_kind_of(Rake::Task)
52
- end
53
-
54
- it 'should include the threshold in the task name' do
55
- Rake.application.last_description.should == 'Verify that yardstick coverage is at least 100%'
56
- end
57
-
58
- it 'should display coverage summary when executed' do
59
- @task.path = 'lib/yardstick.rb' # speed up execution
60
-
61
- capture_stdout { Rake::Task['verify_measurements'].execute }
62
-
63
- @output.should == "YARD-Coverage: 100.0% (threshold: 100%)\n"
64
- end
65
- end
66
-
67
- describe 'with name provided' do
68
- before do
69
- @task = Yardstick::Rake::Verify.new(:custom_task_name) do |verify|
70
- verify.threshold = 100
71
- end
72
- end
73
-
74
- it 'should initialize a Verify instance' do
75
- @task.should be_kind_of(Yardstick::Rake::Verify)
76
- end
77
-
78
- it 'should set name to :custom_task_name' do
79
- @task.instance_variable_get(:@name).should == :custom_task_name
80
- end
81
-
82
- it_should_behave_like 'set default require_exact_threshold for verify task'
83
- it_should_behave_like 'set default path for verify task'
84
- it_should_behave_like 'set default verbose for verify task'
85
-
86
- it 'should create a task named custom_task_name' do
87
- Rake::Task['custom_task_name'].should be_kind_of(Rake::Task)
88
- end
89
-
90
- it 'should include the threshold in the task name' do
91
- Rake.application.last_description.should == 'Verify that yardstick coverage is at least 100%'
92
- end
93
-
94
- it 'should display coverage summary when executed' do
95
- @task.path = 'lib/yardstick.rb' # speed up execution
96
-
97
- capture_stdout { Rake::Task['custom_task_name'].execute }
98
-
99
- @output.should == "YARD-Coverage: 100.0% (threshold: 100%)\n"
100
- end
101
- end
102
-
103
- describe 'with threshold not provided' do
104
- it 'should raise an exception' do
105
- lambda {
106
- Yardstick::Rake::Verify.new {}
107
- }.should raise_error(RuntimeError, 'threshold must be set')
108
- end
109
- end
110
-
111
- describe 'with no block provided' do
112
- it 'should raise an exception' do
113
- lambda {
114
- Yardstick::Rake::Verify.new
115
- }.should raise_error(LocalJumpError)
116
- end
117
- end
118
- end
119
-
120
- describe '#threshold=' do
121
- before do
122
- @task = Yardstick::Rake::Verify.new do |verify|
123
- verify.threshold = 100
124
- end
125
- end
126
-
127
- it 'should set threshold' do
128
- @task.instance_variable_get(:@threshold).should == 100
129
- end
130
- end
131
-
132
- describe '#require_exact_threshold=' do
133
- before do
134
- @task = Yardstick::Rake::Verify.new do |verify|
135
- verify.threshold = 100
136
- verify.require_exact_threshold = false
137
- end
138
- end
139
-
140
- it 'should set require_exact_threshold' do
141
- @task.instance_variable_get(:@require_exact_threshold).should == false
142
- end
143
- end
144
-
145
- describe '#path=' do
146
- before do
147
- @path = 'lib/yardstick.rb'
148
-
149
- @task = Yardstick::Rake::Verify.new do |verify|
150
- verify.threshold = 100
151
- verify.path = @path
152
- end
153
- end
154
-
155
- it 'should set path' do
156
- @task.instance_variable_get(:@path).should equal(@path)
157
- end
158
- end
159
-
160
- describe '#verbose=' do
161
- before do
162
- @task = Yardstick::Rake::Verify.new do |verify|
163
- verify.threshold = 100
164
- verify.verbose = false
165
- end
166
- end
167
-
168
- it 'should set verbose' do
169
- @task.instance_variable_get(:@verbose).should be_false
170
- end
171
- end
172
-
173
- describe '#verify_measurements' do
174
- describe 'with threshold met' do
175
- before do
176
- @task = Yardstick::Rake::Verify.new do |verify|
177
- verify.threshold = 100
178
- verify.path = 'lib/yardstick.rb'
179
- end
180
-
181
- capture_stdout do
182
- @task.verify_measurements
183
- end
184
- end
185
-
186
- it 'should output coverage summary' do
187
- @output.should == "YARD-Coverage: 100.0% (threshold: 100%)\n"
188
- end
189
- end
190
-
191
- describe 'with threshold not met' do
192
- before do
193
- @task = Yardstick::Rake::Verify.new do |verify|
194
- verify.threshold = 101.0
195
- verify.path = 'spec/spec_helper.rb'
196
- end
197
- end
198
-
199
- it 'should raise an exception' do
200
- lambda {
201
- capture_stdout do
202
- @task.verify_measurements
203
- end
204
- }.should raise_error(RuntimeError, 'YARD-Coverage must be at least 101.0% but was 100.0%')
205
-
206
- # check the stdout output
207
- @output.should == "YARD-Coverage: 100.0% (threshold: 101.0%)\n"
208
- end
209
- end
210
-
211
- describe 'with threshold met, but not equal to coverage' do
212
- before do
213
- @task = Yardstick::Rake::Verify.new do |verify|
214
- verify.threshold = 99.9
215
- verify.path = 'lib/yardstick.rb'
216
- end
217
- end
218
-
219
- it 'should raise an exception' do
220
- lambda {
221
- capture_stdout do
222
- @task.verify_measurements
223
- end
224
- }.should raise_error(RuntimeError, 'YARD-Coverage has increased above the threshold of 99.9% to 100.0%. You should update your threshold value.')
225
-
226
- # check the stdout output
227
- @output.should == "YARD-Coverage: 100.0% (threshold: 99.9%)\n"
228
- end
229
- end
230
- end
231
- end
@@ -1,36 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe Yardstick::Rule do
6
- let(:object) { described_class.new(description) { true } }
7
- let(:description) { 'test rule' }
8
-
9
- describe '#eql?' do
10
- subject { object.eql?(other) }
11
-
12
- describe 'when rules are equal' do
13
- let(:other) { described_class.new(description) { true } }
14
-
15
- it 'is true' do
16
- should be(true)
17
- end
18
- end
19
-
20
- describe 'when rules are not equal' do
21
- let(:other) { described_class.new('other rule') { true } }
22
-
23
- it 'is false' do
24
- should be(false)
25
- end
26
- end
27
- end
28
-
29
- describe '#hash' do
30
- subject { object.hash }
31
-
32
- it 'is the expected hash' do
33
- should == description.hash
34
- end
35
- end
36
- end
@@ -1,71 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe Yardstick do
6
- describe '.measure' do
7
- describe 'with no arguments' do
8
- before :all do
9
- @measurements = Yardstick.measure
10
- end
11
-
12
- it_should_behave_like 'measured itself'
13
- end
14
-
15
- describe 'with a String path' do
16
- before :all do
17
- @measurements = Yardstick.measure(Yardstick::ROOT.join('lib', 'yardstick.rb').to_s)
18
- end
19
-
20
- it_should_behave_like 'measured itself'
21
- end
22
-
23
- describe 'with a Pathname' do
24
- before :all do
25
- @measurements = Yardstick.measure(Yardstick::ROOT.join('lib', 'yardstick.rb'))
26
- end
27
-
28
- it_should_behave_like 'measured itself'
29
- end
30
-
31
- describe 'with an Array of String objects' do
32
- before :all do
33
- @measurements = Yardstick.measure([ Yardstick::ROOT.join('lib', 'yardstick.rb').to_s ])
34
- end
35
-
36
- it_should_behave_like 'measured itself'
37
- end
38
-
39
- describe 'with an Array of Pathname objects' do
40
- before :all do
41
- @measurements = Yardstick.measure([ Yardstick::ROOT.join('lib', 'yardstick.rb') ])
42
- end
43
-
44
- it_should_behave_like 'measured itself'
45
- end
46
- end
47
-
48
- describe '.measure_string' do
49
- describe 'with a String' do
50
- before do
51
- @measurements = Yardstick.measure_string('def test; end')
52
- end
53
-
54
- it 'should return a MeasurementSet' do
55
- @measurements.should be_kind_of(Yardstick::MeasurementSet)
56
- end
57
-
58
- it 'should be non-empty' do
59
- @measurements.should_not be_empty
60
- end
61
- end
62
-
63
- describe 'with no arguments' do
64
- it 'should raise an exception' do
65
- lambda {
66
- Yardstick.measure_string
67
- }.should raise_error(ArgumentError)
68
- end
69
- end
70
- end
71
- end