mspec 1.5.17 → 1.5.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. data/.gitignore +27 -0
  2. data/Gemfile +4 -0
  3. data/README +39 -159
  4. data/Rakefile +4 -44
  5. data/bin/mkspec.bat +1 -0
  6. data/bin/mspec-ci.bat +1 -0
  7. data/bin/mspec-run.bat +1 -0
  8. data/bin/mspec-tag.bat +1 -0
  9. data/bin/mspec.bat +1 -0
  10. data/lib/mspec/commands/mkspec.rb +2 -2
  11. data/lib/mspec/commands/mspec-run.rb +4 -0
  12. data/lib/mspec/commands/mspec.rb +18 -3
  13. data/lib/mspec/guards.rb +1 -0
  14. data/lib/mspec/guards/block_device.rb +22 -0
  15. data/lib/mspec/guards/guard.rb +14 -2
  16. data/lib/mspec/helpers.rb +5 -5
  17. data/lib/mspec/helpers/const_lookup.rb +6 -1
  18. data/lib/mspec/helpers/datetime.rb +28 -0
  19. data/lib/mspec/helpers/ducktype.rb +4 -4
  20. data/lib/mspec/helpers/environment.rb +19 -2
  21. data/lib/mspec/helpers/fs.rb +5 -1
  22. data/lib/mspec/helpers/io.rb +39 -1
  23. data/lib/mspec/helpers/numeric.rb +89 -0
  24. data/lib/mspec/helpers/pack.rb +3 -0
  25. data/lib/mspec/helpers/ruby_exe.rb +53 -15
  26. data/lib/mspec/helpers/singleton_class.rb +7 -0
  27. data/lib/mspec/helpers/stasy.rb +33 -0
  28. data/lib/mspec/helpers/tmp.rb +16 -3
  29. data/lib/mspec/matchers.rb +8 -0
  30. data/lib/mspec/matchers/be_computed_by.rb +37 -0
  31. data/lib/mspec/matchers/be_computed_by_function.rb +35 -0
  32. data/lib/mspec/matchers/be_nan.rb +20 -0
  33. data/lib/mspec/matchers/be_valid_dns_name.rb +25 -0
  34. data/lib/mspec/matchers/have_data.rb +6 -5
  35. data/lib/mspec/matchers/have_private_method.rb +24 -0
  36. data/lib/mspec/matchers/have_singleton_method.rb +24 -0
  37. data/lib/mspec/matchers/infinity.rb +28 -0
  38. data/lib/mspec/matchers/match_yaml.rb +5 -5
  39. data/lib/mspec/matchers/raise_error.rb +5 -3
  40. data/lib/mspec/matchers/signed_zero.rb +28 -0
  41. data/lib/mspec/mocks/mock.rb +15 -9
  42. data/lib/mspec/mocks/object.rb +4 -0
  43. data/lib/mspec/mocks/proxy.rb +26 -1
  44. data/lib/mspec/runner/actions.rb +0 -1
  45. data/lib/mspec/runner/context.rb +18 -16
  46. data/lib/mspec/runner/formatters.rb +2 -0
  47. data/lib/mspec/runner/formatters/dotted.rb +13 -1
  48. data/lib/mspec/runner/formatters/junit.rb +96 -0
  49. data/lib/mspec/runner/formatters/profile.rb +70 -0
  50. data/lib/mspec/runner/mspec.rb +11 -0
  51. data/lib/mspec/runner/shared.rb +1 -1
  52. data/lib/mspec/utils/options.rb +33 -9
  53. data/lib/mspec/utils/ruby_name.rb +1 -1
  54. data/lib/mspec/utils/script.rb +2 -1
  55. data/lib/mspec/version.rb +1 -1
  56. data/mspec.gemspec +40 -0
  57. data/spec/commands/mkspec_spec.rb +4 -3
  58. data/spec/commands/mspec_ci_spec.rb +1 -6
  59. data/spec/commands/mspec_run_spec.rb +1 -6
  60. data/spec/commands/mspec_spec.rb +14 -6
  61. data/spec/commands/mspec_tag_spec.rb +28 -27
  62. data/spec/expectations/expectations_spec.rb +1 -1
  63. data/spec/expectations/should_spec.rb +4 -4
  64. data/spec/guards/background_spec.rb +2 -2
  65. data/spec/guards/block_device_spec.rb +46 -0
  66. data/spec/guards/bug_spec.rb +2 -3
  67. data/spec/guards/compliance_spec.rb +2 -2
  68. data/spec/guards/conflict_spec.rb +2 -2
  69. data/spec/guards/endian_spec.rb +2 -2
  70. data/spec/guards/extensions_spec.rb +2 -2
  71. data/spec/guards/feature_spec.rb +2 -2
  72. data/spec/guards/guard_spec.rb +80 -22
  73. data/spec/guards/noncompliance_spec.rb +2 -2
  74. data/spec/guards/platform_spec.rb +2 -2
  75. data/spec/guards/quarantine_spec.rb +2 -2
  76. data/spec/guards/runner_spec.rb +2 -2
  77. data/spec/guards/specified_spec.rb +2 -2
  78. data/spec/guards/superuser_spec.rb +2 -2
  79. data/spec/guards/support_spec.rb +2 -2
  80. data/spec/guards/tty_spec.rb +2 -2
  81. data/spec/guards/user_spec.rb +2 -2
  82. data/spec/guards/version_spec.rb +2 -2
  83. data/spec/helpers/argv_spec.rb +3 -2
  84. data/spec/helpers/const_lookup_spec.rb +3 -2
  85. data/spec/helpers/datetime_spec.rb +44 -0
  86. data/spec/helpers/ducktype_spec.rb +3 -2
  87. data/spec/helpers/encode_spec.rb +3 -2
  88. data/spec/helpers/enumerator_class_spec.rb +5 -5
  89. data/spec/helpers/environment_spec.rb +15 -3
  90. data/spec/helpers/fixture_spec.rb +3 -2
  91. data/spec/helpers/flunk_spec.rb +4 -3
  92. data/spec/helpers/fs_spec.rb +35 -18
  93. data/spec/helpers/hash_spec.rb +3 -2
  94. data/spec/helpers/io_spec.rb +75 -6
  95. data/spec/helpers/language_version_spec.rb +3 -2
  96. data/spec/helpers/mock_to_path_spec.rb +3 -2
  97. data/spec/helpers/numeric_spec.rb +25 -0
  98. data/spec/helpers/ruby_exe_spec.rb +115 -29
  99. data/spec/helpers/scratch_spec.rb +3 -1
  100. data/spec/helpers/stasy_spec.rb +59 -0
  101. data/spec/helpers/tmp_spec.rb +21 -4
  102. data/spec/matchers/base_spec.rb +2 -2
  103. data/spec/matchers/be_an_instance_of_spec.rb +2 -2
  104. data/spec/matchers/be_ancestor_of_spec.rb +2 -2
  105. data/spec/matchers/be_close_spec.rb +2 -2
  106. data/spec/matchers/be_computed_by_function_spec.rb +36 -0
  107. data/spec/matchers/be_computed_by_spec.rb +42 -0
  108. data/spec/matchers/be_empty_spec.rb +2 -2
  109. data/spec/matchers/be_false_spec.rb +3 -3
  110. data/spec/matchers/be_kind_of_spec.rb +2 -2
  111. data/spec/matchers/be_nan_spec.rb +28 -0
  112. data/spec/matchers/be_nil_spec.rb +3 -3
  113. data/spec/matchers/be_true_spec.rb +3 -3
  114. data/spec/matchers/be_valid_dns_name_spec.rb +50 -0
  115. data/spec/matchers/complain_spec.rb +2 -2
  116. data/spec/matchers/eql_spec.rb +2 -2
  117. data/spec/matchers/equal_element_spec.rb +2 -2
  118. data/spec/matchers/equal_spec.rb +2 -2
  119. data/spec/matchers/equal_utf16_spec.rb +2 -2
  120. data/spec/matchers/have_class_variable_spec.rb +3 -3
  121. data/spec/matchers/have_constant_spec.rb +2 -2
  122. data/spec/matchers/have_data_spec.rb +8 -5
  123. data/spec/matchers/have_instance_method_spec.rb +2 -2
  124. data/spec/matchers/have_instance_variable_spec.rb +3 -3
  125. data/spec/matchers/have_method_spec.rb +2 -2
  126. data/spec/matchers/have_private_instance_method_spec.rb +3 -3
  127. data/spec/matchers/have_private_method_spec.rb +44 -0
  128. data/spec/matchers/have_protected_instance_method_spec.rb +2 -2
  129. data/spec/matchers/have_public_instance_method_spec.rb +2 -2
  130. data/spec/matchers/have_singleton_method_spec.rb +45 -0
  131. data/spec/matchers/include_spec.rb +2 -2
  132. data/spec/matchers/infinity_spec.rb +34 -0
  133. data/spec/matchers/match_yaml_spec.rb +3 -3
  134. data/spec/matchers/output_spec.rb +2 -2
  135. data/spec/matchers/output_to_fd_spec.rb +2 -2
  136. data/spec/matchers/raise_error_spec.rb +24 -3
  137. data/spec/matchers/respond_to_spec.rb +2 -2
  138. data/spec/matchers/signed_zero_spec.rb +32 -0
  139. data/spec/matchers/stringsymboladapter_spec.rb +2 -2
  140. data/spec/mocks/mock_spec.rb +12 -12
  141. data/spec/mocks/proxy_spec.rb +1 -1
  142. data/spec/runner/actions/gdb_spec.rb +1 -1
  143. data/spec/runner/actions/tag_spec.rb +1 -1
  144. data/spec/runner/actions/taglist_spec.rb +1 -1
  145. data/spec/runner/context_spec.rb +27 -27
  146. data/spec/runner/example_spec.rb +1 -1
  147. data/spec/runner/exception_spec.rb +1 -1
  148. data/spec/runner/filters/tag_spec.rb +2 -2
  149. data/spec/runner/formatters/describe_spec.rb +1 -1
  150. data/spec/runner/formatters/dotted_spec.rb +2 -2
  151. data/spec/runner/formatters/html_spec.rb +2 -2
  152. data/spec/runner/formatters/junit_spec.rb +147 -0
  153. data/spec/runner/formatters/unit_spec.rb +2 -2
  154. data/spec/runner/formatters/yaml_spec.rb +3 -3
  155. data/spec/runner/mspec_spec.rb +22 -21
  156. data/spec/runner/shared_spec.rb +9 -1
  157. data/spec/runner/tag_spec.rb +1 -1
  158. data/spec/spec_helper.rb +1 -7
  159. data/spec/utils/name_map_spec.rb +1 -2
  160. data/spec/utils/options_spec.rb +58 -27
  161. data/spec/utils/script_spec.rb +5 -13
  162. data/spec/utils/version_spec.rb +1 -1
  163. metadata +254 -64
  164. data/lib/mspec/helpers/bignum.rb +0 -5
  165. data/lib/mspec/helpers/fmode.rb +0 -15
  166. data/lib/mspec/helpers/infinity.rb +0 -5
  167. data/lib/mspec/helpers/metaclass.rb +0 -7
  168. data/lib/mspec/helpers/nan.rb +0 -5
  169. data/lib/mspec/runner/actions/debug.rb +0 -17
  170. data/spec/helpers/bignum_spec.rb +0 -11
  171. data/spec/helpers/fmode_spec.rb +0 -14
  172. data/spec/helpers/infinity_spec.rb +0 -8
  173. data/spec/helpers/nan_spec.rb +0 -8
  174. data/spec/runner/actions/debug_spec.rb +0 -62
@@ -18,6 +18,10 @@ class Object
18
18
  MockObject.new name, options
19
19
  end
20
20
 
21
+ def mock_int(val)
22
+ MockIntObject.new(val)
23
+ end
24
+
21
25
  def mock_numeric(name, options={})
22
26
  NumericMockObject.new name, options
23
27
  end
@@ -7,6 +7,7 @@ class MockObject
7
7
  def method_missing(sym, *args, &block)
8
8
  @null ? self : super
9
9
  end
10
+ private :method_missing
10
11
  end
11
12
 
12
13
  class NumericMockObject < Numeric
@@ -23,6 +24,29 @@ class NumericMockObject < Numeric
23
24
  end
24
25
  end
25
26
 
27
+ class MockIntObject
28
+ def initialize(val)
29
+ @value = val
30
+ @calls = 0
31
+
32
+ key = [self, :to_int]
33
+
34
+ Mock.objects[key] = self
35
+ Mock.mocks[key] << self
36
+ end
37
+
38
+ attr_reader :calls
39
+
40
+ def to_int
41
+ @calls += 1
42
+ @value
43
+ end
44
+
45
+ def count
46
+ [:at_least, 1]
47
+ end
48
+ end
49
+
26
50
  class MockProxy
27
51
  attr_reader :raising, :yielding
28
52
 
@@ -105,7 +129,8 @@ class MockProxy
105
129
  def with(*args)
106
130
  raise ArgumentError, "you must specify the expected arguments" if args.empty?
107
131
  @arguments = *args
108
- if (behaves_like_ruby_1_9 = *[])
132
+ behaves_like_ruby_1_9 = *[]
133
+ if (behaves_like_ruby_1_9)
109
134
  @arguments = @arguments.first if @arguments.length <= 1
110
135
  end
111
136
  self
@@ -4,5 +4,4 @@ require 'mspec/runner/actions/filter'
4
4
  require 'mspec/runner/actions/tag'
5
5
  require 'mspec/runner/actions/taglist'
6
6
  require 'mspec/runner/actions/tagpurge'
7
- require 'mspec/runner/actions/debug'
8
7
  require 'mspec/runner/actions/gdb'
@@ -197,24 +197,26 @@ class ContextState
197
197
 
198
198
  if protect "before :all", pre(:all)
199
199
  @examples.each do |state|
200
- @state = state
201
- example = state.example
202
- MSpec.actions :before, state
203
-
204
- if protect "before :each", pre(:each)
205
- MSpec.clear_expectations
206
- if example
207
- passed = protect nil, example
208
- MSpec.actions :example, state, example
209
- protect nil, @expectation_missing unless MSpec.expectation? or not passed
200
+ MSpec.repeat do
201
+ @state = state
202
+ example = state.example
203
+ MSpec.actions :before, state
204
+
205
+ if protect "before :each", pre(:each)
206
+ MSpec.clear_expectations
207
+ if example
208
+ passed = protect nil, example
209
+ MSpec.actions :example, state, example
210
+ protect nil, @expectation_missing unless MSpec.expectation? or not passed
211
+ end
212
+ protect "after :each", post(:each)
213
+ protect "Mock.verify_count", @mock_verify
210
214
  end
211
- protect "after :each", post(:each)
212
- protect "Mock.verify_count", @mock_verify
213
- end
214
215
 
215
- protect "Mock.cleanup", @mock_cleanup
216
- MSpec.actions :after, state
217
- @state = nil
216
+ protect "Mock.cleanup", @mock_cleanup
217
+ MSpec.actions :after, state
218
+ @state = nil
219
+ end
218
220
  end
219
221
  protect "after :all", post(:all)
220
222
  else
@@ -8,3 +8,5 @@ require 'mspec/runner/formatters/unit'
8
8
  require 'mspec/runner/formatters/spinner'
9
9
  require 'mspec/runner/formatters/method'
10
10
  require 'mspec/runner/formatters/yaml'
11
+ require 'mspec/runner/formatters/profile'
12
+ require 'mspec/runner/formatters/junit'
@@ -14,6 +14,8 @@ class DottedFormatter
14
14
  else
15
15
  @out = File.open out, "w"
16
16
  end
17
+
18
+ @current_state = nil
17
19
  end
18
20
 
19
21
  # Creates the +TimerAction+ and +TallyAction+ instances and
@@ -28,6 +30,13 @@ class DottedFormatter
28
30
  MSpec.register :before, self
29
31
  MSpec.register :after, self
30
32
  MSpec.register :finish, self
33
+ MSpec.register :abort, self
34
+ end
35
+
36
+ def abort
37
+ if @current_state
38
+ puts " aborting example: #{@current_state.description}"
39
+ end
31
40
  end
32
41
 
33
42
  # Returns true if any exception is raised while running
@@ -47,7 +56,8 @@ class DottedFormatter
47
56
 
48
57
  # Callback for the MSpec :before event. Resets the
49
58
  # +#exception?+ and +#failure+ flags.
50
- def before(state = nil)
59
+ def before(state=nil)
60
+ @current_state = state
51
61
  @failure = @exception = false
52
62
  end
53
63
 
@@ -68,6 +78,8 @@ class DottedFormatter
68
78
  # F = An SpecExpectationNotMetError was raised
69
79
  # E = Any exception other than SpecExpectationNotMetError
70
80
  def after(state = nil)
81
+ @current_state = nil
82
+
71
83
  unless exception?
72
84
  print "."
73
85
  else
@@ -0,0 +1,96 @@
1
+ require 'mspec/expectations/expectations'
2
+ require 'mspec/utils/ruby_name'
3
+ require 'mspec/runner/formatters/yaml'
4
+
5
+ class JUnitFormatter < YamlFormatter
6
+ def initialize(out=nil)
7
+ super
8
+ @tests = []
9
+ end
10
+
11
+ def after(state = nil)
12
+ super
13
+ @tests << {:test => state, :exception => false} unless exception?
14
+ end
15
+
16
+ def exception(exception)
17
+ super
18
+ @tests << {:test => exception, :exception => true}
19
+ end
20
+
21
+ def finish
22
+ switch
23
+
24
+ time = @timer.elapsed
25
+ tests = @tally.counter.examples
26
+ errors = @tally.counter.errors
27
+ failures = @tally.counter.failures
28
+
29
+ printf <<-XML
30
+
31
+ <?xml version="1.0" encoding="UTF-8" ?>
32
+ <testsuites
33
+ testCount="#{tests}"
34
+ errorCount="#{errors}"
35
+ failureCount="#{failures}"
36
+ timeCount="#{time}" time="#{time}">
37
+ <testsuite
38
+ tests="#{tests}"
39
+ errors="#{errors}"
40
+ failures="#{failures}"
41
+ time="#{time}"
42
+ name="Spec Output For #{::RUBY_NAME} (#{::RUBY_VERSION})">
43
+ XML
44
+ @tests.each do |h|
45
+ description = encode_for_xml h[:test].description
46
+
47
+ printf <<-XML, "Spec", description, 0.0
48
+ <testcase classname="%s" name="%s" time="%f">
49
+ XML
50
+ if h[:exception]
51
+ outcome = h[:test].failure? ? "failure" : "error"
52
+ message = encode_for_xml h[:test].message
53
+ backtrace = encode_for_xml h[:test].backtrace
54
+ print <<-XML
55
+ <#{outcome} message="error in #{description}" type="#{outcome}">
56
+ #{message}
57
+ #{backtrace}
58
+ </#{outcome}>
59
+ XML
60
+ end
61
+ print <<-XML
62
+ </testcase>
63
+ XML
64
+ end
65
+
66
+ print <<-XML
67
+ </testsuite>
68
+ </testsuites>
69
+ XML
70
+ end
71
+
72
+ private
73
+ LT = "&lt;"
74
+ GT = "&gt;"
75
+ QU = "&quot;"
76
+ AP = "&apos;"
77
+ AM = "&amp;"
78
+ TARGET_ENCODING = "ISO-8859-1"
79
+
80
+ def encode_for_xml(str)
81
+ encode_as_latin1(str).gsub("<", LT).gsub(">", GT).
82
+ gsub('"', QU).gsub("'", AP).gsub("&", AM).
83
+ gsub(/[#{Regexp.escape("\0\1\2\3\4\5\6\7\8")}]/, "?")
84
+ end
85
+
86
+ if defined? Encoding
87
+ def encode_as_latin1(str)
88
+ str.encode(TARGET_ENCODING, :undef => :replace, :invalid => :replace)
89
+ end
90
+ else
91
+ require 'iconv'
92
+ def encode_as_latin1(str)
93
+ Iconv.conv("#{TARGET_ENCODING}//TRANSLIT//IGNORE", "UTF-8", str)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,70 @@
1
+ require 'mspec/expectations/expectations'
2
+ require 'mspec/runner/formatters/dotted'
3
+
4
+ class ProfileFormatter < DottedFormatter
5
+ def initialize(out=nil)
6
+ super
7
+
8
+ @describe_name = nil
9
+ @describe_time = nil
10
+ @describes = []
11
+ @its = []
12
+ end
13
+
14
+ def register
15
+ super
16
+ MSpec.register :enter, self
17
+ end
18
+
19
+ # Callback for the MSpec :enter event. Prints the
20
+ # +describe+ block string.
21
+ def enter(describe)
22
+ if @describe_time
23
+ @describes << [@describe_name, Time.now.to_f - @describe_time]
24
+ end
25
+
26
+ @describe_name = describe
27
+ @describe_time = Time.now.to_f
28
+ end
29
+
30
+ # Callback for the MSpec :before event. Prints the
31
+ # +it+ block string.
32
+ def before(state)
33
+ super
34
+
35
+ @it_name = state.it
36
+ @it_time = Time.now.to_f
37
+ end
38
+
39
+ # Callback for the MSpec :after event. Prints a
40
+ # newline to finish the description string output.
41
+ def after(state)
42
+ @its << [@describe_name, @it_name, Time.now.to_f - @it_time]
43
+ super
44
+ end
45
+
46
+ def finish
47
+ puts "\nProfiling info:"
48
+
49
+ desc = @describes.sort { |a,b| b.last <=> a.last }
50
+ desc.delete_if { |a| a.last <= 0.001 }
51
+ show = desc[0, 100]
52
+
53
+ puts "Top #{show.size} describes:"
54
+
55
+ show.each do |des, time|
56
+ printf "%3.3f - %s\n", time, des
57
+ end
58
+
59
+ its = @its.sort { |a,b| b.last <=> a.last }
60
+ its.delete_if { |a| a.last <= 0.001 }
61
+ show = its[0, 100]
62
+
63
+ puts "\nTop #{show.size} its:"
64
+ show.each do |des, it, time|
65
+ printf "%3.3f - %s %s\n", time, des, it
66
+ end
67
+
68
+ super
69
+ end
70
+ end
@@ -24,6 +24,7 @@ module MSpec
24
24
  @features = {}
25
25
  @exception = nil
26
26
  @randomize = nil
27
+ @repeat = nil
27
28
  @expectation = nil
28
29
  @expectations = false
29
30
 
@@ -229,6 +230,16 @@ module MSpec
229
230
  @randomize == true
230
231
  end
231
232
 
233
+ def self.repeat=(times)
234
+ @repeat = times
235
+ end
236
+
237
+ def self.repeat
238
+ (@repeat || 1).times do
239
+ yield
240
+ end
241
+ end
242
+
232
243
  def self.shuffle(ary)
233
244
  return if ary.empty?
234
245
 
@@ -4,7 +4,7 @@ class Object
4
4
  def it_behaves_like(desc, meth, obj=nil)
5
5
  send :before, :all do
6
6
  @method = meth
7
- @object = obj if obj
7
+ @object = obj
8
8
  end
9
9
 
10
10
  send :it_should_behave_like, desc.to_s
@@ -215,6 +215,12 @@ class MSpecOptions
215
215
  config[:target] = 'ruby1.9'
216
216
  when 'x', 'rubinius'
217
217
  config[:target] = './bin/rbx'
218
+ when 'x18', 'rubinius18'
219
+ config[:target] = './bin/rbx -X18'
220
+ when 'x19', 'rubinius19'
221
+ config[:target] = './bin/rbx -X19'
222
+ when 'x20', 'rubinius20'
223
+ config[:target] = './bin/rbx -X20'
218
224
  when 'X', 'rbx'
219
225
  config[:target] = 'rbx'
220
226
  when 'j', 'jruby'
@@ -223,20 +229,26 @@ class MSpecOptions
223
229
  config[:target] = 'ir'
224
230
  when 'm','maglev'
225
231
  config[:target] = 'maglev-ruby'
232
+ when 't','topaz'
233
+ config[:target] = 'topaz'
226
234
  else
227
235
  config[:target] = t
228
236
  end
229
237
  end
230
238
 
231
239
  doc ""
232
- doc " r or ruby invokes ruby in PATH"
233
- doc " r19, ruby19 or ruby1.9 invokes ruby1.9 in PATH"
234
- doc " x or rubinius invokes ./bin/rbx"
235
- doc " X or rbx invokes rbx in PATH"
236
- doc " j or jruby invokes jruby in PATH"
237
- doc " i or ironruby invokes ir in PATH"
238
- doc " m or maglev invokes maglev-ruby in PATH"
239
- doc " full path to EXE invokes EXE directly\n"
240
+ doc " r or ruby invokes ruby in PATH"
241
+ doc " r19, ruby19 invokes ruby1.9 in PATH"
242
+ doc " x or rubinius invokes ./bin/rbx"
243
+ doc " x18 or rubinius18 invokes ./bin/rbx -X18"
244
+ doc " x19 or rubinius19 invokes ./bin/rbx -X19"
245
+ doc " x20 or rubinius20 invokes ./bin/rbx -X20"
246
+ doc " X or rbx invokes rbx in PATH"
247
+ doc " j or jruby invokes jruby in PATH"
248
+ doc " i or ironruby invokes ir in PATH"
249
+ doc " m or maglev invokes maglev-ruby in PATH"
250
+ doc " t or topaz invokes topaz in PATH"
251
+ doc " full path to EXE invokes EXE directly\n"
240
252
 
241
253
  on("-T", "--target-opt", "OPT",
242
254
  "Pass OPT as a flag to the target implementation") do |t|
@@ -276,6 +288,10 @@ class MSpecOptions
276
288
  config[:formatter] = MethodFormatter
277
289
  when 'y', 'yaml'
278
290
  config[:formatter] = YamlFormatter
291
+ when 'p', 'profile'
292
+ config[:formatter] = ProfileFormatter
293
+ when 'j', 'junit'
294
+ config[:formatter] = JUnitFormatter
279
295
  else
280
296
  puts "Unknown format: #{o}"
281
297
  puts @parser
@@ -292,7 +308,8 @@ class MSpecOptions
292
308
  doc " m, summary SummaryFormatter"
293
309
  doc " a, *, spin SpinnerFormatter"
294
310
  doc " t, method MethodFormatter"
295
- doc " y, yaml YamlFormatter\n"
311
+ doc " y, yaml YamlFormatter"
312
+ doc " j, junit JUnitFormatter\n"
296
313
 
297
314
  on("-o", "--output", "FILE",
298
315
  "Write formatter output to FILE") do |f|
@@ -378,6 +395,13 @@ class MSpecOptions
378
395
  end
379
396
  end
380
397
 
398
+ def repeat
399
+ on("-R", "--repeat", "NUMBER",
400
+ "Repeatedly run an example NUMBER times") do |o|
401
+ MSpec.repeat = o.to_i
402
+ end
403
+ end
404
+
381
405
  def verbose
382
406
  on("-V", "--verbose", "Output the name of each file processed") do
383
407
  obj = Object.new
@@ -3,6 +3,6 @@ unless Object.const_defined?(:RUBY_NAME) and RUBY_NAME
3
3
  RUBY_NAME = RUBY_ENGINE
4
4
  else
5
5
  require 'rbconfig'
6
- RUBY_NAME = Config::CONFIG["RUBY_INSTALL_NAME"] || Config::CONFIG["ruby_install_name"]
6
+ RUBY_NAME = RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"]
7
7
  end
8
8
  end