mutant 0.2.20 → 0.3.0.beta2

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.
Files changed (201) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +10 -11
  3. data/Changelog.md +93 -38
  4. data/Gemfile +3 -1
  5. data/Gemfile.devtools +16 -20
  6. data/Guardfile +1 -1
  7. data/README.md +36 -16
  8. data/Rakefile +21 -2
  9. data/TODO +11 -7
  10. data/bin/mutant +4 -0
  11. data/bin/zombie +4 -0
  12. data/config/devtools.yml +2 -0
  13. data/config/flay.yml +2 -2
  14. data/config/flog.yml +1 -1
  15. data/config/{site.reek → reek.yml} +94 -70
  16. data/lib/mutant/cli/classifier/method.rb +100 -0
  17. data/lib/mutant/cli/classifier/namespace.rb +47 -0
  18. data/lib/mutant/cli/classifier/scope.rb +35 -0
  19. data/lib/mutant/cli/classifier.rb +141 -0
  20. data/lib/mutant/cli.rb +115 -162
  21. data/lib/mutant/color.rb +2 -2
  22. data/lib/mutant/config.rb +27 -0
  23. data/lib/mutant/constants.rb +32 -17
  24. data/lib/mutant/context/scope.rb +33 -51
  25. data/lib/mutant/context.rb +8 -19
  26. data/lib/mutant/differ.rb +5 -5
  27. data/lib/mutant/helper.rb +2 -17
  28. data/lib/mutant/killer/forked.rb +44 -0
  29. data/lib/mutant/killer/forking.rb +3 -57
  30. data/lib/mutant/killer/rspec.rb +16 -20
  31. data/lib/mutant/killer/static.rb +6 -7
  32. data/lib/mutant/killer.rb +48 -74
  33. data/lib/mutant/loader.rb +6 -6
  34. data/lib/mutant/matcher/chain.rb +4 -25
  35. data/lib/mutant/matcher/method/instance.rb +14 -24
  36. data/lib/mutant/matcher/method/singleton.rb +35 -46
  37. data/lib/mutant/matcher/method.rb +95 -83
  38. data/lib/mutant/matcher/{scope_methods.rb → methods.rb} +53 -76
  39. data/lib/mutant/matcher/namespace.rb +71 -0
  40. data/lib/mutant/matcher/scope.rb +34 -0
  41. data/lib/mutant/matcher.rb +24 -34
  42. data/lib/mutant/mutation/evil.rb +35 -0
  43. data/lib/mutant/mutation/filter/code.rb +7 -28
  44. data/lib/mutant/mutation/filter/regexp.rb +6 -18
  45. data/lib/mutant/mutation/filter/whitelist.rb +5 -4
  46. data/lib/mutant/mutation/filter.rb +10 -9
  47. data/lib/mutant/mutation/neutral.rb +35 -0
  48. data/lib/mutant/mutation.rb +21 -61
  49. data/lib/mutant/mutator/node/argument.rb +88 -0
  50. data/lib/mutant/mutator/node/arguments.rb +52 -0
  51. data/lib/mutant/mutator/node/assignment.rb +34 -38
  52. data/lib/mutant/mutator/node/begin.rb +33 -0
  53. data/lib/mutant/mutator/node/block.rb +14 -14
  54. data/lib/mutant/mutator/node/case.rb +59 -0
  55. data/lib/mutant/mutator/node/define.rb +26 -22
  56. data/lib/mutant/mutator/node/if.rb +31 -71
  57. data/lib/mutant/mutator/node/literal/array.rb +25 -9
  58. data/lib/mutant/mutator/node/literal/boolean.rb +13 -30
  59. data/lib/mutant/mutator/node/literal/dynamic.rb +6 -5
  60. data/lib/mutant/mutator/node/literal/fixnum.rb +18 -7
  61. data/lib/mutant/mutator/node/literal/float.rb +15 -8
  62. data/lib/mutant/mutator/node/literal/hash.rb +33 -52
  63. data/lib/mutant/mutator/node/literal/nil.rb +8 -7
  64. data/lib/mutant/mutator/node/literal/range.rb +25 -50
  65. data/lib/mutant/mutator/node/literal/regex.rb +15 -23
  66. data/lib/mutant/mutator/node/literal/string.rb +7 -6
  67. data/lib/mutant/mutator/node/literal/symbol.rb +7 -6
  68. data/lib/mutant/mutator/node/literal.rb +4 -46
  69. data/lib/mutant/mutator/node/mlhs.rb +27 -0
  70. data/lib/mutant/mutator/node/noop.rb +18 -43
  71. data/lib/mutant/mutator/node/return.rb +8 -8
  72. data/lib/mutant/mutator/node/send/binary.rb +31 -0
  73. data/lib/mutant/mutator/node/send.rb +106 -72
  74. data/lib/mutant/mutator/node/super.rb +15 -20
  75. data/lib/mutant/mutator/node/when.rb +32 -7
  76. data/lib/mutant/mutator/node/while.rb +9 -7
  77. data/lib/mutant/mutator/node.rb +116 -66
  78. data/lib/mutant/mutator/registry.rb +14 -11
  79. data/lib/mutant/mutator/util/array.rb +9 -9
  80. data/lib/mutant/mutator/util/symbol.rb +6 -20
  81. data/lib/mutant/mutator/util.rb +6 -3
  82. data/lib/mutant/mutator.rb +12 -28
  83. data/lib/mutant/node_helpers.rb +28 -0
  84. data/lib/mutant/random.rb +3 -2
  85. data/lib/mutant/reporter/cli/printer/config.rb +174 -0
  86. data/lib/mutant/reporter/cli/printer/killer.rb +42 -0
  87. data/lib/mutant/reporter/cli/printer/mutation.rb +55 -0
  88. data/lib/mutant/reporter/cli/printer/subject.rb +147 -0
  89. data/lib/mutant/reporter/cli/printer.rb +165 -0
  90. data/lib/mutant/reporter/cli.rb +9 -277
  91. data/lib/mutant/reporter/null.rb +6 -30
  92. data/lib/mutant/reporter.rb +6 -73
  93. data/lib/mutant/runner/config.rb +82 -0
  94. data/lib/mutant/runner/mutation.rb +58 -0
  95. data/lib/mutant/runner/subject.rb +81 -0
  96. data/lib/mutant/runner.rb +42 -92
  97. data/lib/mutant/singleton_methods.rb +2 -2
  98. data/lib/mutant/strategy/method_expansion.rb +51 -0
  99. data/lib/mutant/strategy/rspec/dm2/lookup/method.rb +142 -0
  100. data/lib/mutant/strategy/rspec/dm2/lookup.rb +61 -0
  101. data/lib/mutant/strategy/rspec/dm2.rb +22 -0
  102. data/lib/mutant/strategy/rspec.rb +20 -22
  103. data/lib/mutant/strategy/static.rb +18 -0
  104. data/lib/mutant/strategy.rb +15 -50
  105. data/lib/mutant/subject/method.rb +100 -0
  106. data/lib/mutant/subject.rb +18 -49
  107. data/lib/mutant/support/method_object.rb +4 -2
  108. data/lib/mutant.rb +40 -35
  109. data/mutant.gemspec +9 -8
  110. data/spec/integration/mutant/rspec_killer_spec.rb +3 -3
  111. data/spec/integration/mutant/test_mutator_handles_types_spec.rb +9 -0
  112. data/spec/integration/mutant/zombie_spec.rb +1 -1
  113. data/spec/shared/method_matcher_behavior.rb +35 -0
  114. data/spec/shared/mutator_behavior.rb +63 -32
  115. data/spec/spec_helper.rb +13 -3
  116. data/spec/support/ice_nine_config.rb +8 -0
  117. data/spec/support/rspec.rb +1 -1
  118. data/spec/support/zombie.rb +1 -1
  119. data/spec/unit/mutant/cli/class_methods/new_spec.rb +42 -28
  120. data/spec/unit/mutant/cli/class_methods/run_spec.rb +15 -13
  121. data/spec/unit/mutant/cli/classifier/class_methods/build_spec.rb +44 -0
  122. data/spec/unit/mutant/context/scope/root_spec.rb +4 -4
  123. data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +6 -5
  124. data/spec/unit/mutant/killer/success_predicate_spec.rb +28 -0
  125. data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +1 -1
  126. data/spec/unit/mutant/matcher/chain/each_spec.rb +1 -1
  127. data/spec/unit/mutant/matcher/chain/matchers_spec.rb +1 -1
  128. data/spec/unit/mutant/matcher/method/instance/each_spec.rb +112 -0
  129. data/spec/unit/mutant/matcher/method/singleton/each_spec.rb +93 -0
  130. data/spec/unit/mutant/matcher/methods/instance/each_spec.rb +59 -0
  131. data/spec/unit/mutant/matcher/methods/singleton/each_spec.rb +53 -0
  132. data/spec/unit/mutant/matcher/namespace/each_spec.rb +37 -0
  133. data/spec/unit/mutant/mutator/node/begin/mutation_spec.rb +33 -0
  134. data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +42 -14
  135. data/spec/unit/mutant/mutator/node/case/mutation_spec.rb +319 -0
  136. data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +31 -27
  137. data/spec/unit/mutant/mutator/node/if/mutation_spec.rb +75 -0
  138. data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +1 -1
  139. data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +2 -2
  140. data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +1 -3
  141. data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +1 -9
  142. data/spec/unit/mutant/mutator/node/return/mutation_spec.rb +6 -2
  143. data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +111 -108
  144. data/spec/unit/mutant/mutator/node/super/mutation_spec.rb +0 -33
  145. data/spec/unit/mutant/mutator/node/while/mutation_spec.rb +2 -2
  146. data/spec/unit/mutant/runner/config/subjects_spec.rb +38 -0
  147. data/spec/unit/mutant/runner/config/success_predicate_spec.rb +53 -0
  148. data/spec/unit/mutant/runner/failed_predicte_spec.rb +33 -0
  149. data/spec/unit/mutant/runner/mutation/killer_spec.rb +39 -0
  150. data/spec/unit/mutant/runner/subject/success_predicate_spec.rb +49 -0
  151. data/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb +49 -0
  152. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/instance/spec_files_spec.rb +52 -0
  153. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb +42 -0
  154. data/spec/unit/mutant/subject/context_spec.rb +6 -3
  155. data/spec/unit/mutant/subject/each_spec.rb +11 -8
  156. data/spec/unit/mutant/subject/node_spec.rb +6 -2
  157. data/test_app/spec/shared/method_filter_parse_behavior.rb +0 -2
  158. data/test_app/spec/shared/method_match_behavior.rb +1 -1
  159. data/test_app/spec/spec_helper.rb +4 -2
  160. metadata +101 -109
  161. data/config/roodi.yml +0 -26
  162. data/lib/mutant/matcher/method/classifier.rb +0 -141
  163. data/lib/mutant/matcher/object_space.rb +0 -114
  164. data/lib/mutant/mutator/node/actual_arguments.rb +0 -25
  165. data/lib/mutant/mutator/node/default_arguments.rb +0 -25
  166. data/lib/mutant/mutator/node/formal_arguments_19/default_mutations.rb +0 -33
  167. data/lib/mutant/mutator/node/formal_arguments_19/pattern_argument_expansion.rb +0 -35
  168. data/lib/mutant/mutator/node/formal_arguments_19/require_defaults.rb +0 -37
  169. data/lib/mutant/mutator/node/formal_arguments_19.rb +0 -41
  170. data/lib/mutant/mutator/node/iter_19.rb +0 -27
  171. data/lib/mutant/mutator/node/literal/empty_array.rb +0 -26
  172. data/lib/mutant/mutator/node/pattern_arguments.rb +0 -41
  173. data/lib/mutant/mutator/node/pattern_variable.rb +0 -23
  174. data/lib/mutant/mutator/node/receiver_case.rb +0 -122
  175. data/lib/mutant/mutator/node/send/binary_operator_method.rb +0 -61
  176. data/lib/mutant/mutator/node/send/with_arguments.rb +0 -81
  177. data/lib/mutant/reporter/stats.rb +0 -120
  178. data/lib/mutant/strategy/rspec/example_lookup.rb +0 -163
  179. data/spec/integration/mutant/method_matching_spec.rb +0 -269
  180. data/spec/shared/method_match_behavior.rb +0 -39
  181. data/spec/unit/mutant/killer/fail_ques_spec.rb +0 -39
  182. data/spec/unit/mutant/matcher/class_methods/from_string_spec.rb +0 -49
  183. data/spec/unit/mutant/matcher/class_methods/parse_spec.rb +0 -12
  184. data/spec/unit/mutant/matcher/method/class_methods/parse_spec.rb +0 -21
  185. data/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb +0 -52
  186. data/spec/unit/mutant/matcher/object_space/class_methods/parse_spec.rb +0 -24
  187. data/spec/unit/mutant/matcher/object_space/each_spec.rb +0 -31
  188. data/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb +0 -60
  189. data/spec/unit/mutant/mutator/node/receiver_case/mutation_spec.rb +0 -27
  190. data/spec/unit/mutant/strategy/rspec/example_lookup/spec_file_spec.rb +0 -236
  191. data/spec/unit/mutant/subject/class_methods/new_spec.rb +0 -13
  192. data/tasks/metrics/ci.rake +0 -7
  193. data/tasks/metrics/flay.rake +0 -41
  194. data/tasks/metrics/flog.rake +0 -43
  195. data/tasks/metrics/heckle.rake +0 -216
  196. data/tasks/metrics/metric_fu.rake +0 -31
  197. data/tasks/metrics/reek.rake +0 -15
  198. data/tasks/metrics/roodi.rake +0 -15
  199. data/tasks/metrics/yardstick.rake +0 -23
  200. data/tasks/spec.rake +0 -45
  201. data/tasks/yard.rake +0 -9
@@ -1,216 +0,0 @@
1
- $LOAD_PATH.unshift(File.expand_path('../../../lib', __FILE__))
2
-
3
- # original code by Ashley Moran:
4
- # http://aviewfromafar.net/2007/11/1/rake-task-for-heckling-your-specs
5
-
6
- begin
7
- require 'pathname'
8
- require 'backports'
9
- require 'active_support/inflector'
10
- require 'heckle'
11
- require 'mspec'
12
- require 'mspec/utils/name_map'
13
-
14
- SKIP_METHODS = %w[ blank_slate_method_added ].freeze
15
-
16
- class NameMap
17
- def file_name(method, constant)
18
- map = MAP[method]
19
- name = if map
20
- map[constant] || map[:default]
21
- else
22
- method.
23
- gsub('?','_ques').
24
- gsub('!','_bang').
25
- gsub('=','_assign')
26
- end
27
- "#{name}_spec.rb"
28
- end
29
- end
30
-
31
- desc 'Heckle each module and class'
32
- task :heckle do
33
- unless Ruby2Ruby::VERSION == '1.2.2'
34
- raise "ruby2ruby version #{Ruby2Ruby::VERSION} may not work properly, 1.2.2 *only* is recommended for use with heckle"
35
- end
36
-
37
- require File.expand_path('../../../spec/support/fake_ast',__FILE__)
38
- require 'mutant'
39
-
40
- root_module_regexp = Regexp.union('Mutant')
41
-
42
- spec_dir = Pathname('spec/unit')
43
-
44
- NameMap::MAP.each do |op, method|
45
- next if method.kind_of?(Hash)
46
- NameMap::MAP[op] = { :default => method }
47
- end
48
-
49
- aliases = Hash.new { |h,mod| h[mod] = Hash.new { |h,method| h[method] = method } }
50
- map = NameMap.new
51
-
52
- heckle_caught_modules = Hash.new { |hash, key| hash[key] = [] }
53
- unhandled_mutations = 0
54
-
55
- ObjectSpace.each_object(Module) do |mod|
56
- next unless mod.name =~ /\A#{root_module_regexp}(?::|\z)/
57
-
58
- # Mutation::Loader is to rbx specific
59
- next if mod == Mutant::Loader
60
- # Mutation::Matcher::Method is to rbx specific
61
- next if mod == Mutant::Matcher::Method
62
- # Mutation::Context::Constant is to rbx specific
63
- next if mod == Mutant::Context::Constant
64
-
65
- spec_prefix = spec_dir.join(mod.name.underscore)
66
-
67
- specs = []
68
-
69
- # get the public class methods
70
- metaclass = class << mod; self end
71
- ancestors = metaclass.ancestors
72
-
73
- spec_class_methods = mod.singleton_methods(false)
74
-
75
- spec_class_methods.reject! do |method|
76
- %w[ yaml_new yaml_tag_subclasses? included nesting constants ].include?(method.to_s)
77
- end
78
-
79
- if mod.ancestors.include?(Singleton)
80
- spec_class_methods.reject! { |method| method.to_s == 'instance' }
81
- end
82
-
83
- # get the protected and private class methods
84
- other_class_methods = metaclass.protected_instance_methods(false) |
85
- metaclass.private_instance_methods(false)
86
-
87
- ancestors.each do |ancestor|
88
- other_class_methods -= ancestor.protected_instance_methods(false) |
89
- ancestor.private_instance_methods(false)
90
- end
91
-
92
- other_class_methods.reject! do |method|
93
- method.to_s == 'allocate' || SKIP_METHODS.include?(method.to_s)
94
- end
95
-
96
- other_class_methods.reject! do |method|
97
- next unless spec_class_methods.any? { |specced| specced.to_s == $1 }
98
-
99
- spec_class_methods << method
100
- end
101
-
102
- # get the instances methods
103
- spec_methods = mod.public_instance_methods(false)
104
-
105
- other_methods = mod.protected_instance_methods(false) |
106
- mod.private_instance_methods(false)
107
-
108
- other_methods.reject! do |method|
109
- next unless spec_methods.any? { |specced| specced.to_s == $1 }
110
-
111
- spec_methods << method
112
- end
113
-
114
- # map the class methods to spec files
115
- spec_class_methods.each do |method|
116
- method = aliases[mod.name][method]
117
- next if SKIP_METHODS.include?(method.to_s)
118
-
119
- spec_file = spec_prefix.join('class_methods').join(map.file_name(method, mod.name))
120
-
121
- unless spec_file.file?
122
- raise "No spec file #{spec_file} for #{mod}.#{method}"
123
- next
124
- end
125
-
126
- specs << [ ".#{method}", [ spec_file ] ]
127
- end
128
-
129
- # map the instance methods to spec files
130
- spec_methods.each do |method|
131
- method = aliases[mod.name][method]
132
- next if SKIP_METHODS.include?(method.to_s)
133
-
134
- spec_file = spec_prefix.join(map.file_name(method, mod.name))
135
-
136
- unless spec_file.file?
137
- raise "No spec file #{spec_file} for #{mod}##{method}"
138
- next
139
- end
140
-
141
- specs << [ "##{method}", [ spec_file ] ]
142
- end
143
-
144
- # non-public methods are considered covered if they can be mutated
145
- # and any spec fails for the current or descendant modules
146
- other_methods.each do |method|
147
- descedant_specs = []
148
-
149
- ObjectSpace.each_object(Module) do |descedant|
150
- next unless descedant.name =~ /\A#{root_module_regexp}(?::|\z)/ && mod >= descedant
151
- descedant_spec_prefix = spec_dir.join(descedant.name.underscore)
152
- descedant_specs << descedant_spec_prefix
153
-
154
- if method.to_s == 'initialize'
155
- descedant_specs.concat(Pathname.glob(descedant_spec_prefix.join('class_methods/new_spec.rb')))
156
- end
157
- end
158
-
159
- specs << [ "##{method}", descedant_specs ]
160
- end
161
-
162
- other_class_methods.each do |method|
163
- descedant_specs = []
164
-
165
- ObjectSpace.each_object(Module) do |descedant|
166
- next unless descedant.name =~ /\A#{root_module_regexp}(?::|\z)/ && mod >= descedant
167
- descedant_specs << spec_dir.join(descedant.name.underscore).join('class_methods')
168
- end
169
-
170
- specs << [ ".#{method}", descedant_specs ]
171
- end
172
-
173
- specs.sort.each do |(method, spec_files)|
174
- puts "Heckling #{mod}#{method}"
175
- IO.popen("spec #{spec_files.join(' ')} --heckle '#{mod}#{method}'") do |pipe|
176
- while line = pipe.gets
177
- case line = line.chomp
178
- when "The following mutations didn't cause test failures:"
179
- heckle_caught_modules[mod.name] << method
180
- when '+++ mutation'
181
- unhandled_mutations += 1
182
- end
183
- end
184
- end
185
- end
186
- end
187
-
188
- if unhandled_mutations > 0
189
- error_message_lines = [ "*************\n" ]
190
-
191
- error_message_lines << "Heckle found #{unhandled_mutations} " \
192
- "mutation#{"s" unless unhandled_mutations == 1} " \
193
- "that didn't cause spec violations\n"
194
-
195
- heckle_caught_modules.each do |mod, methods|
196
- error_message_lines << "#{mod} contains the following " \
197
- 'poorly-specified methods:'
198
- methods.each do |method|
199
- error_message_lines << " - #{method}"
200
- end
201
- error_message_lines << ''
202
- end
203
-
204
- error_message_lines << 'Get your act together and come back ' \
205
- 'when your specs are doing their job!'
206
-
207
- raise error_message_lines.join("\n")
208
- else
209
- puts 'Well done! Your code withstood a heckling.'
210
- end
211
- end
212
- rescue LoadError
213
- task :heckle => :spec do
214
- $stderr.puts 'Heckle or mspec is not available. In order to run heckle, you must: gem install heckle mspec'
215
- end
216
- end
@@ -1,31 +0,0 @@
1
- begin
2
- # Require veritas before metric foo pulls AS
3
- require 'veritas'
4
- require 'metric_fu'
5
- require 'json'
6
-
7
- # XXX: temporary hack until metric_fu is fixed
8
- MetricFu::Saikuro.class_eval { include FileUtils }
9
-
10
- MetricFu::Configuration.run do |config|
11
- config.rcov = {
12
- :environment => 'test',
13
- :test_files => %w[ spec/**/*_spec.rb ],
14
- :rcov_opts => %w[
15
- --sort coverage
16
- --no-html
17
- --text-coverage
18
- --no-color
19
- --profile
20
- --exclude spec/,^/
21
- --include lib:spec
22
- ],
23
- }
24
- end
25
- rescue LoadError
26
- namespace :metrics do
27
- task :all do
28
- $stderr.puts 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu'
29
- end
30
- end
31
- end
@@ -1,15 +0,0 @@
1
- begin
2
- require 'reek/rake/task'
3
-
4
- if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'rbx'
5
- task :reek do
6
- $stderr.puts 'Reek fails under rubinius, fix rubinius and remove guard'
7
- end
8
- else
9
- Reek::Rake::Task.new
10
- end
11
- rescue LoadError
12
- task :reek do
13
- $stderr.puts 'Reek is not available. In order to run reek, you must: gem install reek'
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- begin
2
- require 'roodi'
3
- require 'rake/tasklib'
4
- require 'roodi_task'
5
-
6
- RoodiTask.new do |t|
7
- t.verbose = false
8
- t.config = File.expand_path('../../../config/roodi.yml', __FILE__)
9
- t.patterns = %w[ lib/**/*.rb ]
10
- end
11
- rescue LoadError
12
- task :roodi do
13
- abort 'Roodi is not available. In order to run roodi, you must: gem install roodi'
14
- end
15
- end
@@ -1,23 +0,0 @@
1
- begin
2
- require 'pathname'
3
- require 'yardstick'
4
- require 'yardstick/rake/measurement'
5
- require 'yardstick/rake/verify'
6
- require 'yaml'
7
-
8
- config = YAML.load_file(File.expand_path('../../../config/yardstick.yml', __FILE__))
9
-
10
- # yardstick_measure task
11
- Yardstick::Rake::Measurement.new
12
-
13
- # verify_measurements task
14
- Yardstick::Rake::Verify.new do |verify|
15
- verify.threshold = config.fetch('threshold')
16
- end
17
- rescue LoadError
18
- %w[ yardstick_measure verify_measurements ].each do |name|
19
- task name.to_s do
20
- abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
21
- end
22
- end
23
- end
data/tasks/spec.rake DELETED
@@ -1,45 +0,0 @@
1
- begin
2
-
3
- begin
4
- require 'rspec/core/rake_task'
5
- rescue LoadError
6
- require 'spec/rake/spectask'
7
-
8
- module RSpec
9
- module Core
10
- RakeTask = Spec::Rake::SpecTask
11
- end
12
- end
13
- end
14
-
15
- desc 'run all specs'
16
- task :spec => %w[ spec:unit spec:integration ]
17
-
18
- namespace :spec do
19
- RSpec::Core::RakeTask.new(:integration) do |t|
20
- t.pattern = 'spec/integration/**/*_spec.rb'
21
- end
22
-
23
- RSpec::Core::RakeTask.new(:unit) do |t|
24
- t.pattern = 'spec/unit/**/*_spec.rb'
25
- end
26
- end
27
- rescue LoadError
28
- task :spec do
29
- abort 'rspec is not available. In order to run spec, you must: gem install rspec'
30
- end
31
- end
32
-
33
- begin
34
- desc "Generate code coverage"
35
- RSpec::Core::RakeTask.new(:rcov) do |t|
36
- t.rcov = true
37
- t.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
38
- end
39
- rescue LoadError
40
- task :rcov do
41
- abort 'rcov is not available. In order to run rcov, you must: gem install rcov'
42
- end
43
- end
44
-
45
- task :test => 'spec'
data/tasks/yard.rake DELETED
@@ -1,9 +0,0 @@
1
- begin
2
- require 'yard'
3
-
4
- YARD::Rake::YardocTask.new
5
- rescue LoadError
6
- task :yard do
7
- abort 'YARD is not available. In order to run yard, you must: gem install yard'
8
- end
9
- end