rspec 0.7.5.1 → 0.8.0

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 (194) hide show
  1. data/CHANGES +60 -1
  2. data/EXAMPLES.rd +38 -19
  3. data/MIT-LICENSE +1 -1
  4. data/README +24 -17
  5. data/RELEASE-PLAN +117 -0
  6. data/Rakefile +24 -18
  7. data/TODO.0.8.0 +5 -0
  8. data/examples/auto_spec_name_generation_example.rb +18 -0
  9. data/examples/custom_expectation_matchers.rb +53 -0
  10. data/examples/dynamic_spec.rb +9 -0
  11. data/examples/io_processor_spec.rb +2 -2
  12. data/examples/mocking_example.rb +4 -4
  13. data/examples/partial_mock_example.rb +2 -2
  14. data/examples/predicate_example.rb +2 -2
  15. data/examples/stack_spec.rb +32 -36
  16. data/examples/stubbing_example.rb +19 -19
  17. data/examples/test_case_spec.rb +6 -6
  18. data/lib/spec.rb +3 -0
  19. data/lib/spec/callback.rb +8 -0
  20. data/lib/spec/callback/extensions/object.rb +4 -0
  21. data/lib/spec/deprecated.rb +3 -0
  22. data/lib/spec/expectations.rb +44 -17
  23. data/lib/spec/expectations/extensions.rb +1 -2
  24. data/lib/spec/expectations/extensions/object.rb +78 -130
  25. data/lib/spec/expectations/extensions/string_and_symbol.rb +17 -0
  26. data/lib/spec/expectations/handler.rb +47 -0
  27. data/lib/spec/expectations/should/base.rb +32 -29
  28. data/lib/spec/expectations/should/change.rb +1 -1
  29. data/lib/spec/expectations/should/have.rb +9 -17
  30. data/lib/spec/expectations/should/not.rb +54 -56
  31. data/lib/spec/expectations/should/should.rb +59 -65
  32. data/lib/spec/expectations/sugar.rb +27 -4
  33. data/lib/spec/matchers.rb +160 -0
  34. data/lib/spec/matchers/be.rb +161 -0
  35. data/lib/spec/matchers/be_close.rb +37 -0
  36. data/lib/spec/matchers/change.rb +120 -0
  37. data/lib/spec/matchers/eql.rb +43 -0
  38. data/lib/spec/matchers/equal.rb +43 -0
  39. data/lib/spec/matchers/has.rb +44 -0
  40. data/lib/spec/matchers/have.rb +140 -0
  41. data/lib/spec/matchers/include.rb +50 -0
  42. data/lib/spec/matchers/match.rb +41 -0
  43. data/lib/spec/matchers/raise_error.rb +100 -0
  44. data/lib/spec/matchers/respond_to.rb +35 -0
  45. data/lib/spec/matchers/satisfy.rb +47 -0
  46. data/lib/spec/matchers/throw_symbol.rb +75 -0
  47. data/lib/spec/mocks.rb +224 -1
  48. data/lib/spec/mocks/argument_expectation.rb +16 -2
  49. data/lib/spec/mocks/error_generator.rb +5 -3
  50. data/lib/spec/mocks/errors.rb +2 -2
  51. data/lib/spec/mocks/extensions/object.rb +1 -1
  52. data/lib/spec/mocks/message_expectation.rb +29 -19
  53. data/lib/spec/mocks/{mock_methods.rb → methods.rb} +5 -5
  54. data/lib/spec/mocks/mock.rb +2 -2
  55. data/lib/spec/mocks/mock_handler.rb +81 -68
  56. data/lib/spec/rake/spectask.rb +7 -12
  57. data/lib/spec/rake/verify_rcov.rb +1 -1
  58. data/lib/spec/runner.rb +117 -0
  59. data/lib/spec/runner/command_line.rb +8 -5
  60. data/lib/spec/runner/context.rb +13 -37
  61. data/lib/spec/runner/context_eval.rb +4 -3
  62. data/lib/spec/runner/context_runner.rb +7 -4
  63. data/lib/spec/runner/drb_command_line.rb +1 -1
  64. data/lib/spec/runner/execution_context.rb +3 -11
  65. data/lib/spec/runner/extensions/kernel.rb +7 -5
  66. data/lib/spec/runner/extensions/object.rb +4 -1
  67. data/lib/spec/runner/formatter/base_text_formatter.rb +11 -3
  68. data/lib/spec/runner/formatter/html_formatter.rb +21 -10
  69. data/lib/spec/runner/heckle_runner.rb +24 -8
  70. data/lib/spec/runner/heckle_runner_win.rb +10 -0
  71. data/lib/spec/runner/option_parser.rb +58 -13
  72. data/lib/spec/runner/spec_matcher.rb +22 -29
  73. data/lib/spec/runner/spec_parser.rb +1 -0
  74. data/lib/spec/runner/specification.rb +36 -22
  75. data/lib/spec/translator.rb +87 -0
  76. data/lib/spec/version.rb +16 -7
  77. data/spec/spec/callback/callback_container_spec.rb +27 -0
  78. data/spec/spec/callback/module_spec.rb +37 -0
  79. data/spec/spec/callback/object_spec.rb +90 -0
  80. data/spec/spec/callback/object_with_class_callback_spec.rb +19 -0
  81. data/spec/spec/expectations/differs/default_spec.rb +107 -0
  82. data/spec/spec/expectations/extensions/object_spec.rb +46 -0
  83. data/spec/spec/expectations/fail_with_spec.rb +71 -0
  84. data/spec/spec/expectations/should/should_==_spec.rb +19 -0
  85. data/spec/spec/expectations/should/should_=~_spec.rb +13 -0
  86. data/spec/spec/expectations/should/should_be_a_kind_of_spec.rb +21 -0
  87. data/spec/spec/expectations/should/should_be_an_instance_of_spec.rb +30 -0
  88. data/spec/spec/expectations/should/should_be_arbitrary_predicate_spec.rb +81 -0
  89. data/spec/spec/expectations/should/should_be_close_spec.rb +18 -0
  90. data/spec/spec/expectations/should/should_be_comparison_operator_spec.rb +44 -0
  91. data/spec/spec/expectations/should/should_be_false_spec.rb +39 -0
  92. data/spec/spec/expectations/should/should_be_spec.rb +11 -0
  93. data/spec/spec/expectations/should/should_be_true_spec.rb +27 -0
  94. data/spec/spec/expectations/should/should_change_spec.rb +184 -0
  95. data/spec/spec/expectations/should/should_eql_spec.rb +11 -0
  96. data/spec/spec/expectations/should/should_equal_spec.rb +11 -0
  97. data/spec/spec/expectations/should/should_have_at_least_spec.rb +53 -0
  98. data/spec/spec/expectations/should/should_have_at_most_spec.rb +45 -0
  99. data/spec/spec/expectations/should/should_have_key_spec.rb +21 -0
  100. data/spec/spec/expectations/should/should_have_spec.rb +64 -0
  101. data/spec/spec/expectations/should/should_include_spec.rb +59 -0
  102. data/spec/spec/expectations/should/should_match_spec.rb +25 -0
  103. data/spec/spec/expectations/should/should_not_==_spec.rb +15 -0
  104. data/spec/spec/expectations/should/should_not_be_a_kind_of_spec.rb +21 -0
  105. data/spec/spec/expectations/should/should_not_be_an_instance_of_spec.rb +11 -0
  106. data/spec/spec/expectations/should/should_not_be_arbitrary_predicate_spec.rb +68 -0
  107. data/spec/spec/expectations/should/should_not_be_spec.rb +11 -0
  108. data/spec/spec/expectations/should/should_not_change_spec.rb +24 -0
  109. data/spec/spec/expectations/should/should_not_eql_spec.rb +11 -0
  110. data/spec/spec/expectations/should/should_not_equal_spec.rb +11 -0
  111. data/spec/spec/expectations/should/should_not_have_key_spec.rb +15 -0
  112. data/spec/spec/expectations/should/should_not_include_spec.rb +58 -0
  113. data/spec/spec/expectations/should/should_not_match_spec.rb +11 -0
  114. data/spec/spec/expectations/should/should_not_raise_spec.rb +75 -0
  115. data/spec/spec/expectations/should/should_not_respond_to_spec.rb +15 -0
  116. data/spec/spec/expectations/should/should_not_throw_spec.rb +35 -0
  117. data/spec/spec/expectations/should/should_raise_spec.rb +66 -0
  118. data/spec/spec/expectations/should/should_respond_to_spec.rb +15 -0
  119. data/spec/spec/expectations/should/should_satisfy_spec.rb +35 -0
  120. data/spec/spec/expectations/should/should_throw_spec.rb +27 -0
  121. data/spec/spec/matchers/be_close_spec.rb +33 -0
  122. data/spec/spec/matchers/be_spec.rb +182 -0
  123. data/spec/spec/matchers/change_spec.rb +232 -0
  124. data/spec/spec/matchers/description_generation_spec.rb +147 -0
  125. data/spec/spec/matchers/eql_spec.rb +41 -0
  126. data/spec/spec/matchers/equal_spec.rb +41 -0
  127. data/spec/spec/matchers/handler_spec.rb +75 -0
  128. data/spec/spec/matchers/has_spec.rb +37 -0
  129. data/spec/spec/matchers/have_spec.rb +259 -0
  130. data/spec/spec/matchers/include_spec.rb +33 -0
  131. data/spec/spec/matchers/match_spec.rb +37 -0
  132. data/spec/spec/matchers/matcher_methods_spec.rb +85 -0
  133. data/spec/spec/matchers/raise_error_spec.rb +147 -0
  134. data/spec/spec/matchers/respond_to_spec.rb +30 -0
  135. data/spec/spec/matchers/satisfy_spec.rb +36 -0
  136. data/spec/spec/matchers/throw_symbol_spec.rb +59 -0
  137. data/spec/spec/mocks/any_number_of_times_spec.rb +34 -0
  138. data/spec/spec/mocks/at_least_spec.rb +97 -0
  139. data/spec/spec/mocks/at_most_spec.rb +97 -0
  140. data/spec/spec/mocks/bug_report_7611_spec.rb +19 -0
  141. data/spec/spec/mocks/bug_report_7805_spec.rb +22 -0
  142. data/spec/spec/mocks/bug_report_8165_spec.rb +31 -0
  143. data/spec/spec/mocks/bug_report_8302_spec.rb +26 -0
  144. data/spec/spec/mocks/failing_mock_argument_constraints_spec.rb +74 -0
  145. data/spec/spec/mocks/mock_ordering_spec.rb +80 -0
  146. data/spec/spec/mocks/mock_spec.rb +407 -0
  147. data/spec/spec/mocks/multiple_return_value_spec.rb +113 -0
  148. data/spec/spec/mocks/null_object_mock_spec.rb +40 -0
  149. data/spec/spec/mocks/once_counts_spec.rb +56 -0
  150. data/spec/spec/mocks/options_hash_spec.rb +31 -0
  151. data/spec/spec/mocks/partial_mock_spec.rb +52 -0
  152. data/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +64 -0
  153. data/spec/spec/mocks/passing_mock_argument_constraints_spec.rb +92 -0
  154. data/spec/spec/mocks/precise_counts_spec.rb +56 -0
  155. data/spec/spec/mocks/record_messages_spec.rb +26 -0
  156. data/spec/spec/mocks/stub_spec.rb +159 -0
  157. data/spec/spec/mocks/twice_counts_spec.rb +67 -0
  158. data/spec/spec/runner/command_line_spec.rb +32 -0
  159. data/spec/spec/runner/context_matching_spec.rb +28 -0
  160. data/spec/spec/runner/context_runner_spec.rb +100 -0
  161. data/spec/spec/runner/context_spec.rb +405 -0
  162. data/spec/spec/runner/drb_command_line_spec.rb +74 -0
  163. data/spec/spec/runner/execution_context_spec.rb +52 -0
  164. data/spec/spec/runner/formatter/html_formatter_spec.rb +40 -0
  165. data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +21 -0
  166. data/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb +36 -0
  167. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +78 -0
  168. data/spec/spec/runner/formatter/rdoc_formatter_dry_run_spec.rb +18 -0
  169. data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +41 -0
  170. data/spec/spec/runner/formatter/specdoc_formatter_dry_run_spec.rb +21 -0
  171. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +46 -0
  172. data/spec/spec/runner/heckle_runner_spec.rb +63 -0
  173. data/spec/spec/runner/heckler_spec.rb +14 -0
  174. data/spec/spec/runner/kernel_ext_spec.rb +16 -0
  175. data/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +45 -0
  176. data/spec/spec/runner/object_ext_spec.rb +11 -0
  177. data/spec/spec/runner/option_parser_spec.rb +269 -0
  178. data/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +47 -0
  179. data/spec/spec/runner/reporter_spec.rb +126 -0
  180. data/spec/spec/runner/spec_matcher_spec.rb +107 -0
  181. data/spec/spec/runner/spec_name_generation_spec.rb +102 -0
  182. data/spec/spec/runner/spec_parser_spec.rb +37 -0
  183. data/spec/spec/runner/specification_class_spec.rb +72 -0
  184. data/spec/spec/runner/specification_instance_spec.rb +160 -0
  185. data/spec/spec/runner/specification_should_raise_spec.rb +136 -0
  186. data/spec/spec/spec_classes.rb +102 -0
  187. data/spec/spec/translator_spec.rb +79 -0
  188. data/spec/spec_helper.rb +35 -0
  189. metadata +141 -9
  190. data/bin/drbspec +0 -3
  191. data/lib/spec/expectations/diff.rb +0 -28
  192. data/lib/spec/expectations/extensions/numeric.rb +0 -19
  193. data/lib/spec/expectations/extensions/string.rb +0 -22
  194. data/lib/spec/expectations/message_builder.rb +0 -13
@@ -0,0 +1,136 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
+
3
+ context "a Specification declared with {:should_raise => " do
4
+ setup do
5
+ @reporter = mock("reporter")
6
+ @reporter.stub!(:spec_started)
7
+ end
8
+
9
+ def verify_error(error, message=nil)
10
+ error.should_be_an_instance_of Spec::Expectations::ExpectationNotMetError
11
+ unless message.nil?
12
+ if message.is_a?(Regexp)
13
+ error.message.should =~ message
14
+ else
15
+ error.message.should == message
16
+ end
17
+ end
18
+ end
19
+
20
+ specify "true} should pass when there is an ExpectationNotMetError" do
21
+ spec = Spec::Runner::Specification.new("spec", :should_raise => true) do
22
+ raise Spec::Expectations::ExpectationNotMetError
23
+ end
24
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
25
+ error.should be(nil)
26
+ end
27
+ spec.run(@reporter, nil, nil, nil, nil)
28
+ end
29
+
30
+ specify "true} should fail if nothing is raised" do
31
+ spec = Spec::Runner::Specification.new("spec", :should_raise => true) {}
32
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
33
+ verify_error(error, /specify block expected Exception but nothing was raised/)
34
+ end
35
+ spec.run(@reporter, nil, nil, nil, nil)
36
+ end
37
+
38
+ specify "NameError} should pass when there is a NameError" do
39
+ spec = Spec::Runner::Specification.new("spec", :should_raise => NameError) do
40
+ raise NameError
41
+ end
42
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
43
+ error.should be(nil)
44
+ end
45
+ spec.run(@reporter, nil, nil, nil, nil)
46
+ end
47
+
48
+ specify "NameError} should fail when there is no error" do
49
+ spec = Spec::Runner::Specification.new("spec", :should_raise => NameError) do
50
+ #do nothing
51
+ end
52
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
53
+ verify_error(error,/specify block expected NameError but nothing was raised/)
54
+ end
55
+ spec.run(@reporter, nil, nil, nil, nil)
56
+ end
57
+
58
+ specify "NameError} should fail when there is the wrong error" do
59
+ spec = Spec::Runner::Specification.new("spec", :should_raise => NameError) do
60
+ raise RuntimeError
61
+ end
62
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
63
+ verify_error(error, /specify block expected NameError but raised.+RuntimeError/)
64
+ end
65
+ spec.run(@reporter, nil, nil, nil, nil)
66
+ end
67
+
68
+ specify "[NameError]} should pass when there is a NameError" do
69
+ spec = Spec::Runner::Specification.new("spec", :should_raise => [NameError]) do
70
+ raise NameError
71
+ end
72
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
73
+ error.should be(nil)
74
+ end
75
+ spec.run(@reporter, nil, nil, nil, nil)
76
+ end
77
+
78
+ specify "[NameError]} should fail when there is no error" do
79
+ spec = Spec::Runner::Specification.new("spec", :should_raise => [NameError]) do
80
+ end
81
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
82
+ verify_error(error, /specify block expected NameError but nothing was raised/)
83
+ end
84
+ spec.run(@reporter, nil, nil, nil, nil)
85
+ end
86
+
87
+ specify "[NameError]} should fail when there is the wrong error" do
88
+ spec = Spec::Runner::Specification.new("spec", :should_raise => [NameError]) do
89
+ raise RuntimeError
90
+ end
91
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
92
+ verify_error(error, /specify block expected NameError but raised.+RuntimeError/)
93
+ end
94
+ spec.run(@reporter, nil, nil, nil, nil)
95
+ end
96
+
97
+ specify "[NameError, 'message'} should pass when there is a NameError with the right message" do
98
+ spec = Spec::Runner::Specification.new("spec", :should_raise => [NameError, 'expected']) do
99
+ raise NameError, 'expected'
100
+ end
101
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
102
+ error.should be(nil)
103
+ end
104
+ spec.run(@reporter, nil, nil, nil, nil)
105
+ end
106
+
107
+ specify "[NameError, 'message'} should pass when there is a NameError with a message matching a regex" do
108
+ spec = Spec::Runner::Specification.new("spec", :should_raise => [NameError, /xpec/]) do
109
+ raise NameError, 'expected'
110
+ end
111
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
112
+ error.should be(nil)
113
+ end
114
+ spec.run(@reporter, nil, nil, nil, nil)
115
+ end
116
+
117
+ specify "[NameError, 'message'} should fail when there is a NameError with the wrong message" do
118
+ spec = Spec::Runner::Specification.new("spec", :should_raise => [NameError, 'expected']) do
119
+ raise NameError, 'wrong message'
120
+ end
121
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
122
+ verify_error(error, /specify block expected #<NameError: expected> but raised #<NameError: wrong message>/)
123
+ end
124
+ spec.run(@reporter, nil, nil, nil, nil)
125
+ end
126
+
127
+ specify "[NameError, 'message'} should fail when there is a NameError with a message not matching regexp" do
128
+ spec = Spec::Runner::Specification.new("spec", :should_raise => [NameError, /exp/]) do
129
+ raise NameError, 'wrong message'
130
+ end
131
+ @reporter.should_receive(:spec_finished) do |spec_name, error|
132
+ verify_error(error, /specify block expected #<NameError: \(\?-mix:exp\)> but raised #<NameError: wrong message>/)
133
+ end
134
+ spec.run(@reporter, nil, nil, nil, nil)
135
+ end
136
+ end
@@ -0,0 +1,102 @@
1
+ # This file contains various classes used by the specs.
2
+ module Spec
3
+ module Expectations
4
+ class Person
5
+ attr_reader :name
6
+ def initialize name
7
+ @name = name
8
+ end
9
+ def == other
10
+ return @name == other.name
11
+ end
12
+ end
13
+
14
+ class ClassWithMultiWordPredicate
15
+ def multi_word_predicate?
16
+ true
17
+ end
18
+ end
19
+
20
+ module Helper
21
+ class CollectionWithSizeMethod
22
+ def initialize; @list = []; end
23
+ def size; @list.size; end
24
+ def push(item); @list.push(item); end
25
+ end
26
+
27
+ class CollectionWithLengthMethod
28
+ def initialize; @list = []; end
29
+ def length; @list.size; end
30
+ def push(item); @list.push(item); end
31
+ end
32
+
33
+ class CollectionOwner
34
+ attr_reader :items_in_collection_with_size_method, :items_in_collection_with_length_method
35
+
36
+ def initialize
37
+ @items_in_collection_with_size_method = CollectionWithSizeMethod.new
38
+ @items_in_collection_with_length_method = CollectionWithLengthMethod.new
39
+ end
40
+
41
+ def add_to_collection_with_size_method(item)
42
+ @items_in_collection_with_size_method.push(item)
43
+ end
44
+
45
+ def add_to_collection_with_length_method(item)
46
+ @items_in_collection_with_length_method.push(item)
47
+ end
48
+
49
+ def items_for(arg)
50
+ return [1, 2, 3] if arg == 'a'
51
+ [1]
52
+ end
53
+
54
+ end
55
+
56
+ class HandCodedMock
57
+ include Spec::Matchers
58
+ def initialize(return_val)
59
+ @return_val = return_val
60
+ @funny_called = false
61
+ end
62
+
63
+ def funny?
64
+ @funny_called = true
65
+ @return_val
66
+ end
67
+
68
+ def hungry?(a, b, c)
69
+ a.should equal(1)
70
+ b.should equal(2)
71
+ c.should equal(3)
72
+ @funny_called = true
73
+ @return_val
74
+ end
75
+
76
+ def exists?
77
+ @return_val
78
+ end
79
+
80
+ def multi_word_predicate?
81
+ @return_val
82
+ end
83
+
84
+ def __verify
85
+ @funny_called.should be(true)
86
+ end
87
+ end
88
+ class ClassWithUnqueriedPredicate
89
+ attr_accessor :foo
90
+ def initialize(foo)
91
+ @foo = foo
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+
98
+ module Custom
99
+ class Formatter
100
+ end
101
+ end
102
+
@@ -0,0 +1,79 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ context "Translator" do
4
+ setup do
5
+ @t = Spec::Translator.new
6
+ end
7
+
8
+ specify "should translate files" do
9
+ from = File.dirname(__FILE__) + '/..'
10
+ to = File.dirname(__FILE__) + '/../../translated_specs'
11
+ @t.translate_dir(from, to)
12
+ end
13
+
14
+ specify "should translate should_be_close" do
15
+ @t.translate('5.0.should_be_close(5.0, 0.5)').should eql('5.0.should be_close(5.0, 0.5)')
16
+ end
17
+
18
+ specify "should translate should_not_raise" do
19
+ @t.translate('lambda { self.call }.should_not_raise').should eql('lambda { self.call }.should_not raise_error')
20
+ end
21
+
22
+ specify "should translate should_throw" do
23
+ @t.translate('lambda { self.call }.should_throw').should eql('lambda { self.call }.should throw_symbol')
24
+ end
25
+
26
+ specify "should not translate 0.9 should_not" do
27
+ @t.translate('@target.should_not @matcher').should eql('@target.should_not @matcher')
28
+ end
29
+
30
+ specify "should leave should_not_receive" do
31
+ @t.translate('@mock.should_not_receive(:not_expected).with("unexpected text")').should eql('@mock.should_not_receive(:not_expected).with("unexpected text")')
32
+ end
33
+
34
+ specify "should leave should_receive" do
35
+ @t.translate('@mock.should_receive(:not_expected).with("unexpected text")').should eql('@mock.should_receive(:not_expected).with("unexpected text")')
36
+ end
37
+
38
+ specify "should translate multi word predicates" do
39
+ @t.translate('foo.should_multi_word_predicate').should eql('foo.should be_multi_word_predicate')
40
+ end
41
+
42
+ specify "should translate multi word predicates prefixed with be" do
43
+ @t.translate('foo.should_be_multi_word_predicate').should eql('foo.should be_multi_word_predicate')
44
+ end
45
+
46
+ specify "should translate be(expected) to equal(expected)" do
47
+ @t.translate('foo.should_be :cool').should eql('foo.should equal :cool')
48
+ end
49
+
50
+ specify "should translate instance_of" do
51
+ @t.translate('5.should_be_an_instance_of(Integer)').should eql('5.should be_an_instance_of(Integer)')
52
+ end
53
+
54
+ specify "should translate should_be <" do
55
+ @t.translate('3.should_be < 4').should eql('3.should be < 4')
56
+ end
57
+
58
+ specify "should translate should_be <=" do
59
+ @t.translate('3.should_be <= 4').should eql('3.should be <= 4')
60
+ end
61
+
62
+ specify "should translate should_be >=" do
63
+ @t.translate('4.should_be >= 3').should eql('4.should be >= 3')
64
+ end
65
+
66
+ specify "should translate should_be >" do
67
+ @t.translate('4.should_be > 3').should eql('4.should be > 3')
68
+ end
69
+
70
+ =begin
71
+
72
+ specify "should translate kind of" do
73
+ @t.translate('@object.should_receive(:foobar).should_be_kind_of(MessageExpectation)').should(
74
+ eql('@object.should_receive(:foobar).should be_kind_of(MessageExpectation)'))
75
+ end
76
+
77
+ =end
78
+
79
+ end
@@ -0,0 +1,35 @@
1
+ require 'stringio'
2
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
3
+ require 'spec'
4
+ require File.dirname(__FILE__) + '/../spec/spec/spec_classes'
5
+
6
+ module Spec
7
+ module Matchers
8
+ def fail
9
+ raise_error(Spec::Expectations::ExpectationNotMetError)
10
+ end
11
+
12
+ def fail_with(message)
13
+ raise_error(Spec::Expectations::ExpectationNotMetError, message)
14
+ end
15
+
16
+ class Pass
17
+ def matches?(proc, &block)
18
+ begin
19
+ proc.call
20
+ true
21
+ rescue => @error
22
+ false
23
+ end
24
+ end
25
+
26
+ def failure_message
27
+ @error.message + "\n" + @error.backtrace.join("\n")
28
+ end
29
+ end
30
+
31
+ def pass
32
+ Pass.new
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.9.1
3
3
  specification_version: 1
4
4
  name: rspec
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.7.5.1
7
- date: 2007-01-18 00:00:00 -06:00
8
- summary: RSpec-0.7.5.1 (r1395) - BDD for Ruby http://rspec.rubyforge.org/
6
+ version: 0.8.0
7
+ date: 2007-02-28 00:00:00 +00:00
8
+ summary: RSpec-0.8.0 (r1550) - BDD for Ruby http://rspec.rubyforge.org/
9
9
  require_paths:
10
10
  - lib
11
11
  email: rspec-devel@rubyforge.org
@@ -34,38 +34,54 @@ files:
34
34
  - MIT-LICENSE
35
35
  - Rakefile
36
36
  - README
37
+ - RELEASE-PLAN
38
+ - TODO.0.8.0
37
39
  - lib/spec.rb
38
40
  - lib/spec/callback.rb
41
+ - lib/spec/deprecated.rb
39
42
  - lib/spec/expectations.rb
43
+ - lib/spec/matchers.rb
40
44
  - lib/spec/mocks.rb
41
45
  - lib/spec/runner.rb
46
+ - lib/spec/translator.rb
42
47
  - lib/spec/version.rb
43
48
  - lib/spec/callback/callback_container.rb
44
49
  - lib/spec/callback/extensions/module.rb
45
50
  - lib/spec/callback/extensions/object.rb
46
- - lib/spec/expectations/diff.rb
47
51
  - lib/spec/expectations/errors.rb
48
52
  - lib/spec/expectations/extensions.rb
49
- - lib/spec/expectations/message_builder.rb
53
+ - lib/spec/expectations/handler.rb
50
54
  - lib/spec/expectations/should.rb
51
55
  - lib/spec/expectations/sugar.rb
52
56
  - lib/spec/expectations/differs/default.rb
53
- - lib/spec/expectations/extensions/numeric.rb
54
57
  - lib/spec/expectations/extensions/object.rb
55
58
  - lib/spec/expectations/extensions/proc.rb
56
- - lib/spec/expectations/extensions/string.rb
59
+ - lib/spec/expectations/extensions/string_and_symbol.rb
57
60
  - lib/spec/expectations/should/base.rb
58
61
  - lib/spec/expectations/should/change.rb
59
62
  - lib/spec/expectations/should/have.rb
60
63
  - lib/spec/expectations/should/not.rb
61
64
  - lib/spec/expectations/should/should.rb
65
+ - lib/spec/matchers/be.rb
66
+ - lib/spec/matchers/be_close.rb
67
+ - lib/spec/matchers/change.rb
68
+ - lib/spec/matchers/eql.rb
69
+ - lib/spec/matchers/equal.rb
70
+ - lib/spec/matchers/has.rb
71
+ - lib/spec/matchers/have.rb
72
+ - lib/spec/matchers/include.rb
73
+ - lib/spec/matchers/match.rb
74
+ - lib/spec/matchers/raise_error.rb
75
+ - lib/spec/matchers/respond_to.rb
76
+ - lib/spec/matchers/satisfy.rb
77
+ - lib/spec/matchers/throw_symbol.rb
62
78
  - lib/spec/mocks/argument_expectation.rb
63
79
  - lib/spec/mocks/error_generator.rb
64
80
  - lib/spec/mocks/errors.rb
65
81
  - lib/spec/mocks/message_expectation.rb
82
+ - lib/spec/mocks/methods.rb
66
83
  - lib/spec/mocks/mock.rb
67
84
  - lib/spec/mocks/mock_handler.rb
68
- - lib/spec/mocks/mock_methods.rb
69
85
  - lib/spec/mocks/order_group.rb
70
86
  - lib/spec/mocks/extensions/object.rb
71
87
  - lib/spec/rake/spectask.rb
@@ -79,6 +95,7 @@ files:
79
95
  - lib/spec/runner/execution_context.rb
80
96
  - lib/spec/runner/formatter.rb
81
97
  - lib/spec/runner/heckle_runner.rb
98
+ - lib/spec/runner/heckle_runner_win.rb
82
99
  - lib/spec/runner/option_parser.rb
83
100
  - lib/spec/runner/reporter.rb
84
101
  - lib/spec/runner/spec_matcher.rb
@@ -92,7 +109,122 @@ files:
92
109
  - lib/spec/runner/formatter/progress_bar_formatter.rb
93
110
  - lib/spec/runner/formatter/rdoc_formatter.rb
94
111
  - lib/spec/runner/formatter/specdoc_formatter.rb
112
+ - spec/spec_helper.rb
113
+ - spec/spec/spec_classes.rb
114
+ - spec/spec/translator_spec.rb
115
+ - spec/spec/callback/callback_container_spec.rb
116
+ - spec/spec/callback/module_spec.rb
117
+ - spec/spec/callback/object_spec.rb
118
+ - spec/spec/callback/object_with_class_callback_spec.rb
119
+ - spec/spec/expectations/fail_with_spec.rb
120
+ - spec/spec/expectations/differs/default_spec.rb
121
+ - spec/spec/expectations/extensions/object_spec.rb
122
+ - spec/spec/expectations/should/should_==_spec.rb
123
+ - spec/spec/expectations/should/should_=~_spec.rb
124
+ - spec/spec/expectations/should/should_be_a_kind_of_spec.rb
125
+ - spec/spec/expectations/should/should_be_an_instance_of_spec.rb
126
+ - spec/spec/expectations/should/should_be_arbitrary_predicate_spec.rb
127
+ - spec/spec/expectations/should/should_be_close_spec.rb
128
+ - spec/spec/expectations/should/should_be_comparison_operator_spec.rb
129
+ - spec/spec/expectations/should/should_be_false_spec.rb
130
+ - spec/spec/expectations/should/should_be_spec.rb
131
+ - spec/spec/expectations/should/should_be_true_spec.rb
132
+ - spec/spec/expectations/should/should_change_spec.rb
133
+ - spec/spec/expectations/should/should_eql_spec.rb
134
+ - spec/spec/expectations/should/should_equal_spec.rb
135
+ - spec/spec/expectations/should/should_have_at_least_spec.rb
136
+ - spec/spec/expectations/should/should_have_at_most_spec.rb
137
+ - spec/spec/expectations/should/should_have_key_spec.rb
138
+ - spec/spec/expectations/should/should_have_spec.rb
139
+ - spec/spec/expectations/should/should_include_spec.rb
140
+ - spec/spec/expectations/should/should_match_spec.rb
141
+ - spec/spec/expectations/should/should_not_==_spec.rb
142
+ - spec/spec/expectations/should/should_not_be_a_kind_of_spec.rb
143
+ - spec/spec/expectations/should/should_not_be_an_instance_of_spec.rb
144
+ - spec/spec/expectations/should/should_not_be_arbitrary_predicate_spec.rb
145
+ - spec/spec/expectations/should/should_not_be_spec.rb
146
+ - spec/spec/expectations/should/should_not_change_spec.rb
147
+ - spec/spec/expectations/should/should_not_eql_spec.rb
148
+ - spec/spec/expectations/should/should_not_equal_spec.rb
149
+ - spec/spec/expectations/should/should_not_have_key_spec.rb
150
+ - spec/spec/expectations/should/should_not_include_spec.rb
151
+ - spec/spec/expectations/should/should_not_match_spec.rb
152
+ - spec/spec/expectations/should/should_not_raise_spec.rb
153
+ - spec/spec/expectations/should/should_not_respond_to_spec.rb
154
+ - spec/spec/expectations/should/should_not_throw_spec.rb
155
+ - spec/spec/expectations/should/should_raise_spec.rb
156
+ - spec/spec/expectations/should/should_respond_to_spec.rb
157
+ - spec/spec/expectations/should/should_satisfy_spec.rb
158
+ - spec/spec/expectations/should/should_throw_spec.rb
159
+ - spec/spec/matchers/be_close_spec.rb
160
+ - spec/spec/matchers/be_spec.rb
161
+ - spec/spec/matchers/change_spec.rb
162
+ - spec/spec/matchers/description_generation_spec.rb
163
+ - spec/spec/matchers/eql_spec.rb
164
+ - spec/spec/matchers/equal_spec.rb
165
+ - spec/spec/matchers/handler_spec.rb
166
+ - spec/spec/matchers/has_spec.rb
167
+ - spec/spec/matchers/have_spec.rb
168
+ - spec/spec/matchers/include_spec.rb
169
+ - spec/spec/matchers/match_spec.rb
170
+ - spec/spec/matchers/matcher_methods_spec.rb
171
+ - spec/spec/matchers/raise_error_spec.rb
172
+ - spec/spec/matchers/respond_to_spec.rb
173
+ - spec/spec/matchers/satisfy_spec.rb
174
+ - spec/spec/matchers/throw_symbol_spec.rb
175
+ - spec/spec/mocks/any_number_of_times_spec.rb
176
+ - spec/spec/mocks/at_least_spec.rb
177
+ - spec/spec/mocks/at_most_spec.rb
178
+ - spec/spec/mocks/bug_report_7611_spec.rb
179
+ - spec/spec/mocks/bug_report_7805_spec.rb
180
+ - spec/spec/mocks/bug_report_8165_spec.rb
181
+ - spec/spec/mocks/bug_report_8302_spec.rb
182
+ - spec/spec/mocks/failing_mock_argument_constraints_spec.rb
183
+ - spec/spec/mocks/mock_ordering_spec.rb
184
+ - spec/spec/mocks/mock_spec.rb
185
+ - spec/spec/mocks/multiple_return_value_spec.rb
186
+ - spec/spec/mocks/null_object_mock_spec.rb
187
+ - spec/spec/mocks/once_counts_spec.rb
188
+ - spec/spec/mocks/options_hash_spec.rb
189
+ - spec/spec/mocks/partial_mock_spec.rb
190
+ - spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb
191
+ - spec/spec/mocks/passing_mock_argument_constraints_spec.rb
192
+ - spec/spec/mocks/precise_counts_spec.rb
193
+ - spec/spec/mocks/record_messages_spec.rb
194
+ - spec/spec/mocks/stub_spec.rb
195
+ - spec/spec/mocks/twice_counts_spec.rb
196
+ - spec/spec/runner/command_line_spec.rb
197
+ - spec/spec/runner/context_matching_spec.rb
198
+ - spec/spec/runner/context_runner_spec.rb
199
+ - spec/spec/runner/context_spec.rb
200
+ - spec/spec/runner/drb_command_line_spec.rb
201
+ - spec/spec/runner/execution_context_spec.rb
202
+ - spec/spec/runner/heckle_runner_spec.rb
203
+ - spec/spec/runner/heckler_spec.rb
204
+ - spec/spec/runner/kernel_ext_spec.rb
205
+ - spec/spec/runner/noisy_backtrace_tweaker_spec.rb
206
+ - spec/spec/runner/object_ext_spec.rb
207
+ - spec/spec/runner/option_parser_spec.rb
208
+ - spec/spec/runner/quiet_backtrace_tweaker_spec.rb
209
+ - spec/spec/runner/reporter_spec.rb
210
+ - spec/spec/runner/spec_matcher_spec.rb
211
+ - spec/spec/runner/spec_name_generation_spec.rb
212
+ - spec/spec/runner/spec_parser_spec.rb
213
+ - spec/spec/runner/specification_class_spec.rb
214
+ - spec/spec/runner/specification_instance_spec.rb
215
+ - spec/spec/runner/specification_should_raise_spec.rb
216
+ - spec/spec/runner/formatter/html_formatter_spec.rb
217
+ - spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb
218
+ - spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb
219
+ - spec/spec/runner/formatter/progress_bar_formatter_spec.rb
220
+ - spec/spec/runner/formatter/rdoc_formatter_dry_run_spec.rb
221
+ - spec/spec/runner/formatter/rdoc_formatter_spec.rb
222
+ - spec/spec/runner/formatter/specdoc_formatter_dry_run_spec.rb
223
+ - spec/spec/runner/formatter/specdoc_formatter_spec.rb
224
+ - examples/auto_spec_name_generation_example.rb
225
+ - examples/custom_expectation_matchers.rb
95
226
  - examples/custom_formatter.rb
227
+ - examples/dynamic_spec.rb
96
228
  - examples/file_accessor.rb
97
229
  - examples/file_accessor_spec.rb
98
230
  - examples/greeter_spec.rb
@@ -121,9 +253,9 @@ extra_rdoc_files:
121
253
  - README
122
254
  - CHANGES
123
255
  - MIT-LICENSE
256
+ - RELEASE-PLAN
124
257
  executables:
125
258
  - spec
126
- - drbspec
127
259
  extensions: []
128
260
 
129
261
  requirements: []