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
@@ -1,5 +0,0 @@
1
- class Object
2
- def bignum_value(plus=0)
3
- 0x8000_0000_0000_0000 + plus
4
- end
5
- end
@@ -1,15 +0,0 @@
1
- require 'mspec/guards/feature'
2
-
3
- class Object
4
- # This helper simplifies passing file access modes regardless of
5
- # whether the :encoding feature is enabled. Only the access specifier
6
- # itself will be returned if :encoding is not enabled. Otherwise,
7
- # the full mode string will be returned (i.e. the helper is a no-op).
8
- def fmode(mode)
9
- if FeatureGuard.enabled? :encoding
10
- mode
11
- else
12
- mode.split(':').first
13
- end
14
- end
15
- end
@@ -1,5 +0,0 @@
1
- class Object
2
- def infinity_value
3
- 1/0.0
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- class Object
2
- unless method_defined? :metaclass
3
- def metaclass
4
- class << self; self; end
5
- end
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- class Object
2
- def nan_value
3
- 0/0.0
4
- end
5
- end
@@ -1,17 +0,0 @@
1
- require 'mspec/runner/actions/filter'
2
-
3
- class DebugAction < ActionFilter
4
- def before(state)
5
- Kernel.debugger if self === state.description
6
- end
7
-
8
- def register
9
- super
10
- MSpec.register :before, self
11
- end
12
-
13
- def unregister
14
- super
15
- MSpec.unregister :before, self
16
- end
17
- end
@@ -1,11 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require 'mspec/helpers/bignum'
3
-
4
- describe Object, "#bignum_value" do
5
- it "returns a value that is an instance of Bignum on any platform" do
6
- bignum_value.should == 0x8000_0000_0000_0000
7
- end
8
-
9
- it "returns the default value incremented by the argument" do
10
- end
11
- end
@@ -1,14 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require 'mspec/helpers/fmode'
3
-
4
- describe Object, "#fmode" do
5
- it "returns the argument unmodified if :encoding feature is enabled" do
6
- FeatureGuard.should_receive(:enabled?).with(:encoding).and_return(true)
7
- fmode("rb:binary:utf-8").should == "rb:binary:utf-8"
8
- end
9
-
10
- it "returns only the file access mode if :encoding feature is not enabled" do
11
- FeatureGuard.should_receive(:enabled?).with(:encoding).and_return(false)
12
- fmode("rb:binary:utf-8").should == "rb"
13
- end
14
- end
@@ -1,8 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require 'mspec/helpers/infinity'
3
-
4
- describe Object, "#infinity_value" do
5
- it "returns Infinity" do
6
- infinity_value.infinite?.should == 1
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require 'mspec/helpers/nan'
3
-
4
- describe Object, "#nan_value" do
5
- it "returns NaN" do
6
- nan_value.nan?.should be_true
7
- end
8
- end
@@ -1,62 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'mspec/runner/actions/debug'
3
- require 'mspec/runner/mspec'
4
- require 'mspec/runner/context'
5
- require 'mspec/runner/example'
6
-
7
- describe DebugAction do
8
- before :each do
9
- MSpec.stub!(:read_tags).and_return([])
10
- end
11
-
12
- it "creates an MatchFilter with its tag and desc arguments" do
13
- filter = mock('action filter', :null_object => true)
14
- MatchFilter.should_receive(:new).with(nil, "some", "thing").and_return(filter)
15
- DebugAction.new ["tag", "key"], ["some", "thing"]
16
- end
17
- end
18
-
19
- describe DebugAction, "#before" do
20
- before :each do
21
- MSpec.stub!(:read_tags).and_return([])
22
- @state = ExampleState.new ContextState.new("Catch#me"), "if you can"
23
- end
24
-
25
- it "does not invoke the debugger if the description does not match" do
26
- Kernel.should_not_receive(:debugger)
27
- action = DebugAction.new nil, "match"
28
- action.before @state
29
- end
30
-
31
- it "invokes the debugger if the description matches" do
32
- Kernel.should_receive(:debugger)
33
- action = DebugAction.new nil, "can"
34
- action.before @state
35
- end
36
- end
37
-
38
- describe DebugAction, "#register" do
39
- before :each do
40
- MSpec.stub!(:read_tags).and_return([])
41
- MSpec.stub!(:register)
42
- @action = DebugAction.new nil, nil
43
- end
44
-
45
- it "registers itself with MSpec for the :before action" do
46
- MSpec.should_receive(:register).with(:before, @action)
47
- @action.register
48
- end
49
- end
50
-
51
- describe DebugAction, "#unregister" do
52
- before :each do
53
- MSpec.stub!(:read_tags).and_return([])
54
- MSpec.stub!(:unregister)
55
- @action = DebugAction.new nil, nil
56
- end
57
-
58
- it "unregisters itself with MSpec for the :before action" do
59
- MSpec.should_receive(:unregister).with(:before, @action)
60
- @action.unregister
61
- end
62
- end