rr 0.3.11 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. data/CHANGES +8 -3
  2. data/README +130 -39
  3. data/Rakefile +6 -5
  4. data/lib/rr.rb +8 -8
  5. data/lib/rr/adapters/rr_methods.rb +228 -0
  6. data/lib/rr/adapters/rspec.rb +1 -1
  7. data/lib/rr/adapters/test_unit.rb +1 -1
  8. data/lib/rr/double.rb +294 -89
  9. data/lib/rr/{scenario_creator.rb → double_creator.rb} +65 -66
  10. data/lib/rr/{scenario_definition.rb → double_definition.rb} +36 -36
  11. data/lib/rr/{scenario_definition_builder.rb → double_definition_builder.rb} +3 -3
  12. data/lib/rr/double_insertion.rb +132 -0
  13. data/lib/rr/{scenario_matches.rb → double_matches.rb} +2 -2
  14. data/lib/rr/{scenario_method_proxy.rb → double_method_proxy.rb} +2 -2
  15. data/lib/rr/errors/argument_equality_error.rb +3 -3
  16. data/lib/rr/errors/rr_error.rb +13 -13
  17. data/lib/rr/errors/scenario_definition_error.rb +3 -3
  18. data/lib/rr/errors/scenario_not_found_error.rb +3 -3
  19. data/lib/rr/errors/scenario_order_error.rb +3 -3
  20. data/lib/rr/errors/times_called_error.rb +3 -3
  21. data/lib/rr/expectations/any_argument_expectation.rb +1 -1
  22. data/lib/rr/expectations/argument_equality_expectation.rb +1 -1
  23. data/lib/rr/expectations/times_called_expectation.rb +1 -1
  24. data/lib/rr/hash_with_object_id_key.rb +1 -1
  25. data/lib/rr/space.rb +40 -40
  26. data/lib/rr/times_called_matchers/any_times_matcher.rb +13 -13
  27. data/lib/rr/times_called_matchers/at_least_matcher.rb +11 -11
  28. data/lib/rr/times_called_matchers/at_most_matcher.rb +16 -16
  29. data/lib/rr/times_called_matchers/integer_matcher.rb +13 -13
  30. data/lib/rr/times_called_matchers/non_terminal.rb +21 -21
  31. data/lib/rr/times_called_matchers/proc_matcher.rb +7 -7
  32. data/lib/rr/times_called_matchers/range_matcher.rb +14 -14
  33. data/lib/rr/times_called_matchers/terminal.rb +16 -16
  34. data/lib/rr/times_called_matchers/times_called_matcher.rb +32 -32
  35. data/spec/core_spec_suite.rb +18 -0
  36. data/{examples → spec}/environment_fixture_setup.rb +0 -1
  37. data/{examples/high_level_example.rb → spec/high_level_spec.rb} +11 -11
  38. data/spec/rr/adapters/rr_methods_argument_matcher_spec.rb +67 -0
  39. data/spec/rr/adapters/rr_methods_creator_spec.rb +365 -0
  40. data/spec/rr/adapters/rr_methods_space_spec.rb +134 -0
  41. data/spec/rr/adapters/rr_methods_spec_helper.rb +11 -0
  42. data/{examples/rr/extensions/instance_methods_times_matcher_example.rb → spec/rr/adapters/rr_methods_times_matcher_spec.rb} +4 -4
  43. data/spec/rr/double/double_insertion_bind_spec.rb +78 -0
  44. data/spec/rr/double/double_insertion_dispatching_spec.rb +221 -0
  45. data/spec/rr/double/double_insertion_has_original_method_spec.rb +56 -0
  46. data/spec/rr/double/double_insertion_register_scenario_spec.rb +24 -0
  47. data/spec/rr/double/double_insertion_reset_spec.rb +89 -0
  48. data/spec/rr/double/double_insertion_spec.rb +66 -0
  49. data/spec/rr/double/double_insertion_verify_spec.rb +23 -0
  50. data/spec/rr/double_creator_spec.rb +454 -0
  51. data/{examples/rr/scenario_definition_example.rb → spec/rr/double_definition_spec.rb} +143 -143
  52. data/spec/rr/double_method_proxy_spec.rb +71 -0
  53. data/spec/rr/double_spec.rb +654 -0
  54. data/spec/rr/errors/rr_error_spec.rb +65 -0
  55. data/spec/rr/expectations/any_argument_expectation_spec.rb +47 -0
  56. data/spec/rr/expectations/anything_argument_equality_expectation_spec.rb +38 -0
  57. data/spec/rr/expectations/argument_equality_expectation_spec.rb +58 -0
  58. data/spec/rr/expectations/boolean_argument_equality_expectation_spec.rb +53 -0
  59. data/spec/rr/expectations/duck_type_argument_equality_expectation_spec.rb +71 -0
  60. data/spec/rr/expectations/is_a_argument_equality_expectation_spec.rb +51 -0
  61. data/spec/rr/expectations/numeric_argument_equality_expectation_spec.rb +47 -0
  62. data/spec/rr/expectations/range_argument_equality_expectation_spec.rb +59 -0
  63. data/spec/rr/expectations/regexp_argument_equality_expectation_spec.rb +72 -0
  64. data/spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb +43 -0
  65. data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb +67 -0
  66. data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_most_spec.rb +71 -0
  67. data/spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +21 -0
  68. data/spec/rr/expectations/times_called_expectation/times_called_expectation_integer_spec.rb +103 -0
  69. data/spec/rr/expectations/times_called_expectation/times_called_expectation_proc_spec.rb +79 -0
  70. data/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb +81 -0
  71. data/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb +40 -0
  72. data/spec/rr/rspec/rspec_adapter_spec.rb +65 -0
  73. data/spec/rr/rspec/rspec_backtrace_tweaking_spec.rb +52 -0
  74. data/spec/rr/rspec/rspec_usage_spec.rb +67 -0
  75. data/spec/rr/space/hash_with_object_id_key_spec.rb +88 -0
  76. data/spec/rr/space/space_create_spec.rb +278 -0
  77. data/spec/rr/space/space_helper.rb +7 -0
  78. data/spec/rr/space/space_register_spec.rb +32 -0
  79. data/spec/rr/space/space_reset_spec.rb +131 -0
  80. data/spec/rr/space/space_spec.rb +32 -0
  81. data/spec/rr/space/space_verify_spec.rb +181 -0
  82. data/{examples → spec}/rr/test_unit/test_helper.rb +1 -1
  83. data/{examples → spec}/rr/test_unit/test_unit_backtrace_test.rb +0 -0
  84. data/{examples → spec}/rr/test_unit/test_unit_integration_test.rb +4 -4
  85. data/spec/rr/times_called_matchers/any_times_matcher_spec.rb +47 -0
  86. data/spec/rr/times_called_matchers/at_least_matcher_spec.rb +55 -0
  87. data/spec/rr/times_called_matchers/at_most_matcher_spec.rb +70 -0
  88. data/spec/rr/times_called_matchers/integer_matcher_spec.rb +70 -0
  89. data/spec/rr/times_called_matchers/proc_matcher_spec.rb +55 -0
  90. data/spec/rr/times_called_matchers/range_matcher_spec.rb +76 -0
  91. data/spec/rr/times_called_matchers/times_called_matcher_spec.rb +118 -0
  92. data/spec/rspec_spec_suite.rb +16 -0
  93. data/spec/spec_helper.rb +9 -0
  94. data/{examples/example_suite.rb → spec/spec_suite.rb} +3 -3
  95. data/{examples/test_unit_example_suite.rb → spec/test_unit_spec_suite.rb} +0 -0
  96. metadata +93 -93
  97. data/examples/core_example_suite.rb +0 -31
  98. data/examples/example_helper.rb +0 -9
  99. data/examples/rr/double/double_bind_example.rb +0 -70
  100. data/examples/rr/double/double_dispatching_example.rb +0 -236
  101. data/examples/rr/double/double_example.rb +0 -66
  102. data/examples/rr/double/double_has_original_method_example.rb +0 -56
  103. data/examples/rr/double/double_register_scenario_example.rb +0 -24
  104. data/examples/rr/double/double_reset_example.rb +0 -89
  105. data/examples/rr/double/double_verify_example.rb +0 -23
  106. data/examples/rr/errors/rr_error_example.rb +0 -65
  107. data/examples/rr/expectations/any_argument_expectation_example.rb +0 -52
  108. data/examples/rr/expectations/anything_argument_equality_expectation_example.rb +0 -38
  109. data/examples/rr/expectations/argument_equality_expectation_example.rb +0 -62
  110. data/examples/rr/expectations/boolean_argument_equality_expectation_example.rb +0 -48
  111. data/examples/rr/expectations/duck_type_argument_equality_expectation_example.rb +0 -67
  112. data/examples/rr/expectations/is_a_argument_equality_expectation_example.rb +0 -50
  113. data/examples/rr/expectations/numeric_argument_equality_expectation_example.rb +0 -46
  114. data/examples/rr/expectations/range_argument_equality_expectation_example.rb +0 -59
  115. data/examples/rr/expectations/regexp_argument_equality_expectation_example.rb +0 -67
  116. data/examples/rr/expectations/times_called_expectation/times_called_expectation_any_times_example.rb +0 -50
  117. data/examples/rr/expectations/times_called_expectation/times_called_expectation_at_least_example.rb +0 -73
  118. data/examples/rr/expectations/times_called_expectation/times_called_expectation_at_most_example.rb +0 -77
  119. data/examples/rr/expectations/times_called_expectation/times_called_expectation_example.rb +0 -42
  120. data/examples/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +0 -20
  121. data/examples/rr/expectations/times_called_expectation/times_called_expectation_integer_example.rb +0 -111
  122. data/examples/rr/expectations/times_called_expectation/times_called_expectation_proc_example.rb +0 -88
  123. data/examples/rr/expectations/times_called_expectation/times_called_expectation_range_example.rb +0 -90
  124. data/examples/rr/extensions/instance_methods_argument_matcher_example.rb +0 -65
  125. data/examples/rr/extensions/instance_methods_creator_example.rb +0 -363
  126. data/examples/rr/extensions/instance_methods_example_helper.rb +0 -11
  127. data/examples/rr/extensions/instance_methods_space_example.rb +0 -122
  128. data/examples/rr/rspec/rspec_adapter_example.rb +0 -63
  129. data/examples/rr/rspec/rspec_backtrace_tweaking_example.rb +0 -36
  130. data/examples/rr/rspec/rspec_usage_example.rb +0 -65
  131. data/examples/rr/scenario_creator_example.rb +0 -459
  132. data/examples/rr/scenario_example.rb +0 -701
  133. data/examples/rr/scenario_method_proxy_example.rb +0 -71
  134. data/examples/rr/space/hash_with_object_id_key_example.rb +0 -86
  135. data/examples/rr/space/space_create_example.rb +0 -278
  136. data/examples/rr/space/space_example.rb +0 -29
  137. data/examples/rr/space/space_helper.rb +0 -7
  138. data/examples/rr/space/space_register_example.rb +0 -32
  139. data/examples/rr/space/space_reset_example.rb +0 -120
  140. data/examples/rr/space/space_verify_example.rb +0 -169
  141. data/examples/rr/times_called_matchers/any_times_matcher_example.rb +0 -63
  142. data/examples/rr/times_called_matchers/at_least_matcher_example.rb +0 -70
  143. data/examples/rr/times_called_matchers/at_most_matcher_example.rb +0 -85
  144. data/examples/rr/times_called_matchers/integer_matcher_example.rb +0 -91
  145. data/examples/rr/times_called_matchers/proc_matcher_example.rb +0 -77
  146. data/examples/rr/times_called_matchers/range_matcher_example.rb +0 -97
  147. data/examples/rr/times_called_matchers/times_called_matcher_example.rb +0 -53
  148. data/examples/rspec_example_suite.rb +0 -25
  149. data/lib/rr/extensions/instance_methods.rb +0 -228
  150. data/lib/rr/scenario.rb +0 -337
@@ -1,13 +1,13 @@
1
- require "examples/example_helper"
1
+ require "spec/spec_helper"
2
2
 
3
3
  module RR
4
- describe ScenarioDefinition, :shared => true do
4
+ describe DoubleDefinition, :shared => true do
5
5
  before do
6
6
  @space = Space.new
7
7
  @object = Object.new
8
8
  add_original_method
9
- @double = @space.double(@object, :foobar)
10
- @scenario = @space.scenario(@double)
9
+ @double_insertion = @space.double_insertion(@object, :foobar)
10
+ @scenario = @space.scenario(@double_insertion)
11
11
  @definition = @scenario.definition
12
12
  end
13
13
 
@@ -18,14 +18,14 @@ describe ScenarioDefinition, :shared => true do
18
18
  end
19
19
  end
20
20
 
21
- describe ScenarioDefinition, " with returns block_callback_strategy", :shared => true do
21
+ describe DoubleDefinition, " with returns block_callback_strategy", :shared => true do
22
22
  before do
23
23
  @definition.returns_block_callback_strategy!
24
24
  create_definition
25
25
  end
26
26
  end
27
27
 
28
- describe ScenarioDefinition, " with after_call block_callback_strategy", :shared => true do
28
+ describe DoubleDefinition, " with after_call block_callback_strategy", :shared => true do
29
29
  before do
30
30
  @definition.implemented_by_original_method
31
31
  @definition.after_call_block_callback_strategy!
@@ -33,10 +33,10 @@ describe ScenarioDefinition, " with after_call block_callback_strategy", :shared
33
33
  end
34
34
  end
35
35
 
36
- describe ScenarioDefinition, "#with", :shared => true do
37
- it_should_behave_like "RR::ScenarioDefinition"
36
+ describe DoubleDefinition, "#with", :shared => true do
37
+ it_should_behave_like "RR::DoubleDefinition"
38
38
 
39
- it "returns ScenarioDefinition" do
39
+ it "returns DoubleDefinition" do
40
40
  @definition.with(1).should === @definition
41
41
  end
42
42
 
@@ -57,9 +57,9 @@ describe ScenarioDefinition, "#with", :shared => true do
57
57
  end
58
58
  end
59
59
 
60
- describe ScenarioDefinition, "#with with returns block_callback_strategy" do
61
- it_should_behave_like "RR::ScenarioDefinition#with"
62
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
60
+ describe DoubleDefinition, "#with with returns block_callback_strategy" do
61
+ it_should_behave_like "RR::DoubleDefinition#with"
62
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
63
63
 
64
64
  it "sets return value when block passed in" do
65
65
  @return_value.should == :new_return_value
@@ -67,9 +67,9 @@ describe ScenarioDefinition, "#with with returns block_callback_strategy" do
67
67
  end
68
68
  end
69
69
 
70
- describe ScenarioDefinition, "#with with after_call block_callback_strategy" do
71
- it_should_behave_like "RR::ScenarioDefinition#with"
72
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
70
+ describe DoubleDefinition, "#with with after_call block_callback_strategy" do
71
+ it_should_behave_like "RR::DoubleDefinition#with"
72
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
73
73
 
74
74
  it "sets return value when block passed in" do
75
75
  @return_value.should == :new_return_value
@@ -77,10 +77,10 @@ describe ScenarioDefinition, "#with with after_call block_callback_strategy" do
77
77
  end
78
78
  end
79
79
 
80
- describe ScenarioDefinition, "#with_any_args", :shared => true do
81
- it_should_behave_like "RR::ScenarioDefinition"
80
+ describe DoubleDefinition, "#with_any_args", :shared => true do
81
+ it_should_behave_like "RR::DoubleDefinition"
82
82
 
83
- it "returns ScenarioDefinition" do
83
+ it "returns DoubleDefinition" do
84
84
  @definition.with_no_args.should === @definition
85
85
  end
86
86
 
@@ -100,9 +100,9 @@ describe ScenarioDefinition, "#with_any_args", :shared => true do
100
100
  end
101
101
  end
102
102
 
103
- describe ScenarioDefinition, "#with_any_args with returns block_callback_strategy" do
104
- it_should_behave_like "RR::ScenarioDefinition#with_any_args"
105
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
103
+ describe DoubleDefinition, "#with_any_args with returns block_callback_strategy" do
104
+ it_should_behave_like "RR::DoubleDefinition#with_any_args"
105
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
106
106
 
107
107
  it "sets return value when block passed in" do
108
108
  @return_value.should == :new_return_value
@@ -110,9 +110,9 @@ describe ScenarioDefinition, "#with_any_args with returns block_callback_strateg
110
110
  end
111
111
  end
112
112
 
113
- describe ScenarioDefinition, "#with_any_args with after_call block_callback_strategy" do
114
- it_should_behave_like "RR::ScenarioDefinition#with_any_args"
115
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
113
+ describe DoubleDefinition, "#with_any_args with after_call block_callback_strategy" do
114
+ it_should_behave_like "RR::DoubleDefinition#with_any_args"
115
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
116
116
 
117
117
  it "sets return value when block passed in" do
118
118
  @return_value.should == :new_return_value
@@ -120,10 +120,10 @@ describe ScenarioDefinition, "#with_any_args with after_call block_callback_stra
120
120
  end
121
121
  end
122
122
 
123
- describe ScenarioDefinition, "#with_no_args", :shared => true do
124
- it_should_behave_like "RR::ScenarioDefinition"
123
+ describe DoubleDefinition, "#with_no_args", :shared => true do
124
+ it_should_behave_like "RR::DoubleDefinition"
125
125
 
126
- it "returns ScenarioDefinition" do
126
+ it "returns DoubleDefinition" do
127
127
  @definition.with_no_args.should === @definition
128
128
  end
129
129
 
@@ -148,9 +148,9 @@ describe ScenarioDefinition, "#with_no_args", :shared => true do
148
148
  end
149
149
  end
150
150
 
151
- describe ScenarioDefinition, "#with_no_args with returns block_callback_strategy" do
152
- it_should_behave_like "RR::ScenarioDefinition#with_no_args"
153
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
151
+ describe DoubleDefinition, "#with_no_args with returns block_callback_strategy" do
152
+ it_should_behave_like "RR::DoubleDefinition#with_no_args"
153
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
154
154
 
155
155
  it "sets return value when block passed in" do
156
156
  @return_value.should == :new_return_value
@@ -158,9 +158,9 @@ describe ScenarioDefinition, "#with_no_args with returns block_callback_strategy
158
158
  end
159
159
  end
160
160
 
161
- describe ScenarioDefinition, "#with_no_args with after_call block_callback_strategy" do
162
- it_should_behave_like "RR::ScenarioDefinition#with_no_args"
163
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
161
+ describe DoubleDefinition, "#with_no_args with after_call block_callback_strategy" do
162
+ it_should_behave_like "RR::DoubleDefinition#with_no_args"
163
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
164
164
 
165
165
  it "sets return value when block passed in" do
166
166
  @return_value.should == :new_return_value
@@ -168,10 +168,10 @@ describe ScenarioDefinition, "#with_no_args with after_call block_callback_strat
168
168
  end
169
169
  end
170
170
 
171
- describe ScenarioDefinition, "#never" do
172
- it_should_behave_like "RR::ScenarioDefinition"
171
+ describe DoubleDefinition, "#never" do
172
+ it_should_behave_like "RR::DoubleDefinition"
173
173
 
174
- it "returns ScenarioDefinition" do
174
+ it "returns DoubleDefinition" do
175
175
  @definition.never.should === @definition
176
176
  end
177
177
 
@@ -187,10 +187,10 @@ describe ScenarioDefinition, "#never" do
187
187
  end
188
188
  end
189
189
 
190
- describe ScenarioDefinition, "#once", :shared => true do
191
- it_should_behave_like "RR::ScenarioDefinition"
190
+ describe DoubleDefinition, "#once", :shared => true do
191
+ it_should_behave_like "RR::DoubleDefinition"
192
192
 
193
- it "returns ScenarioDefinition" do
193
+ it "returns DoubleDefinition" do
194
194
  @definition.once.should === @definition
195
195
  end
196
196
 
@@ -209,9 +209,9 @@ describe ScenarioDefinition, "#once", :shared => true do
209
209
  end
210
210
  end
211
211
 
212
- describe ScenarioDefinition, "#once with returns block_callback_strategy" do
213
- it_should_behave_like "RR::ScenarioDefinition#once"
214
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
212
+ describe DoubleDefinition, "#once with returns block_callback_strategy" do
213
+ it_should_behave_like "RR::DoubleDefinition#once"
214
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
215
215
 
216
216
  it "sets return value when block passed in" do
217
217
  @return_value.should == :new_return_value
@@ -219,9 +219,9 @@ describe ScenarioDefinition, "#once with returns block_callback_strategy" do
219
219
  end
220
220
  end
221
221
 
222
- describe ScenarioDefinition, "#once with after_call block_callback_strategy" do
223
- it_should_behave_like "RR::ScenarioDefinition#once"
224
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
222
+ describe DoubleDefinition, "#once with after_call block_callback_strategy" do
223
+ it_should_behave_like "RR::DoubleDefinition#once"
224
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
225
225
 
226
226
  it "sets return value when block passed in" do
227
227
  @return_value.should == :new_return_value
@@ -229,10 +229,10 @@ describe ScenarioDefinition, "#once with after_call block_callback_strategy" do
229
229
  end
230
230
  end
231
231
 
232
- describe ScenarioDefinition, "#twice", :shared => true do
233
- it_should_behave_like "RR::ScenarioDefinition"
232
+ describe DoubleDefinition, "#twice", :shared => true do
233
+ it_should_behave_like "RR::DoubleDefinition"
234
234
 
235
- it "returns ScenarioDefinition" do
235
+ it "returns DoubleDefinition" do
236
236
  @definition.twice.should === @definition
237
237
  end
238
238
 
@@ -253,9 +253,9 @@ describe ScenarioDefinition, "#twice", :shared => true do
253
253
  end
254
254
  end
255
255
 
256
- describe ScenarioDefinition, "#twice with returns block_callback_strategy" do
257
- it_should_behave_like "RR::ScenarioDefinition#twice"
258
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
256
+ describe DoubleDefinition, "#twice with returns block_callback_strategy" do
257
+ it_should_behave_like "RR::DoubleDefinition#twice"
258
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
259
259
 
260
260
  it "sets return value when block passed in" do
261
261
  @return_value.should == :new_return_value
@@ -263,9 +263,9 @@ describe ScenarioDefinition, "#twice with returns block_callback_strategy" do
263
263
  end
264
264
  end
265
265
 
266
- describe ScenarioDefinition, "#twice with after_call block_callback_strategy" do
267
- it_should_behave_like "RR::ScenarioDefinition#twice"
268
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
266
+ describe DoubleDefinition, "#twice with after_call block_callback_strategy" do
267
+ it_should_behave_like "RR::DoubleDefinition#twice"
268
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
269
269
 
270
270
  it "sets return value when block passed in" do
271
271
  @return_value.should == :new_return_value
@@ -273,10 +273,10 @@ describe ScenarioDefinition, "#twice with after_call block_callback_strategy" do
273
273
  end
274
274
  end
275
275
 
276
- describe ScenarioDefinition, "#at_least", :shared => true do
277
- it_should_behave_like "RR::ScenarioDefinition"
276
+ describe DoubleDefinition, "#at_least", :shared => true do
277
+ it_should_behave_like "RR::DoubleDefinition"
278
278
 
279
- it "returns ScenarioDefinition" do
279
+ it "returns DoubleDefinition" do
280
280
  @definition.with_any_args.at_least(2).should === @definition
281
281
  end
282
282
 
@@ -296,9 +296,9 @@ describe ScenarioDefinition, "#at_least", :shared => true do
296
296
  end
297
297
  end
298
298
 
299
- describe ScenarioDefinition, "#at_least with returns block_callback_strategy" do
300
- it_should_behave_like "RR::ScenarioDefinition#at_least"
301
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
299
+ describe DoubleDefinition, "#at_least with returns block_callback_strategy" do
300
+ it_should_behave_like "RR::DoubleDefinition#at_least"
301
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
302
302
 
303
303
  it "sets return value when block passed in" do
304
304
  @return_value.should == :new_return_value
@@ -306,9 +306,9 @@ describe ScenarioDefinition, "#at_least with returns block_callback_strategy" do
306
306
  end
307
307
  end
308
308
 
309
- describe ScenarioDefinition, "#at_least with after_call block_callback_strategy" do
310
- it_should_behave_like "RR::ScenarioDefinition#at_least"
311
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
309
+ describe DoubleDefinition, "#at_least with after_call block_callback_strategy" do
310
+ it_should_behave_like "RR::DoubleDefinition#at_least"
311
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
312
312
 
313
313
  it "sets return value when block passed in" do
314
314
  @return_value.should == :new_return_value
@@ -316,10 +316,10 @@ describe ScenarioDefinition, "#at_least with after_call block_callback_strategy"
316
316
  end
317
317
  end
318
318
 
319
- describe ScenarioDefinition, "#at_most", :shared => true do
320
- it_should_behave_like "RR::ScenarioDefinition"
319
+ describe DoubleDefinition, "#at_most", :shared => true do
320
+ it_should_behave_like "RR::DoubleDefinition"
321
321
 
322
- it "returns ScenarioDefinition" do
322
+ it "returns DoubleDefinition" do
323
323
  @definition.with_any_args.at_most(2).should === @definition
324
324
  end
325
325
 
@@ -344,9 +344,9 @@ describe ScenarioDefinition, "#at_most", :shared => true do
344
344
  end
345
345
  end
346
346
 
347
- describe ScenarioDefinition, "#at_most with returns block_callback_strategy" do
348
- it_should_behave_like "RR::ScenarioDefinition#at_most"
349
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
347
+ describe DoubleDefinition, "#at_most with returns block_callback_strategy" do
348
+ it_should_behave_like "RR::DoubleDefinition#at_most"
349
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
350
350
 
351
351
  it "sets return value when block passed in" do
352
352
  @return_value.should == :new_return_value
@@ -354,9 +354,9 @@ describe ScenarioDefinition, "#at_most with returns block_callback_strategy" do
354
354
  end
355
355
  end
356
356
 
357
- describe ScenarioDefinition, "#at_most with after_call block_callback_strategy" do
358
- it_should_behave_like "RR::ScenarioDefinition#at_most"
359
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
357
+ describe DoubleDefinition, "#at_most with after_call block_callback_strategy" do
358
+ it_should_behave_like "RR::DoubleDefinition#at_most"
359
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
360
360
 
361
361
  it "sets return value when block passed in" do
362
362
  @return_value.should == :new_return_value
@@ -364,10 +364,10 @@ describe ScenarioDefinition, "#at_most with after_call block_callback_strategy"
364
364
  end
365
365
  end
366
366
 
367
- describe ScenarioDefinition, "#times", :shared => true do
368
- it_should_behave_like "RR::ScenarioDefinition"
367
+ describe DoubleDefinition, "#times", :shared => true do
368
+ it_should_behave_like "RR::DoubleDefinition"
369
369
 
370
- it "returns ScenarioDefinition" do
370
+ it "returns DoubleDefinition" do
371
371
  @definition.times(3).should === @definition
372
372
  end
373
373
 
@@ -388,9 +388,9 @@ describe ScenarioDefinition, "#times", :shared => true do
388
388
  end
389
389
  end
390
390
 
391
- describe ScenarioDefinition, "#times with returns block_callback_strategy" do
392
- it_should_behave_like "RR::ScenarioDefinition#times"
393
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
391
+ describe DoubleDefinition, "#times with returns block_callback_strategy" do
392
+ it_should_behave_like "RR::DoubleDefinition#times"
393
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
394
394
 
395
395
  it "sets return value when block passed in" do
396
396
  @return_value.should == :new_return_value
@@ -398,9 +398,9 @@ describe ScenarioDefinition, "#times with returns block_callback_strategy" do
398
398
  end
399
399
  end
400
400
 
401
- describe ScenarioDefinition, "#times with after_call block_callback_strategy" do
402
- it_should_behave_like "RR::ScenarioDefinition#times"
403
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
401
+ describe DoubleDefinition, "#times with after_call block_callback_strategy" do
402
+ it_should_behave_like "RR::DoubleDefinition#times"
403
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
404
404
 
405
405
  it "sets return value when block passed in" do
406
406
  @return_value.should == :new_return_value
@@ -408,10 +408,10 @@ describe ScenarioDefinition, "#times with after_call block_callback_strategy" do
408
408
  end
409
409
  end
410
410
 
411
- describe ScenarioDefinition, "#any_number_of_times", :shared => true do
412
- it_should_behave_like "RR::ScenarioDefinition"
411
+ describe DoubleDefinition, "#any_number_of_times", :shared => true do
412
+ it_should_behave_like "RR::DoubleDefinition"
413
413
 
414
- it "returns ScenarioDefinition" do
414
+ it "returns DoubleDefinition" do
415
415
  @definition.any_number_of_times.should === @definition
416
416
  end
417
417
 
@@ -431,9 +431,9 @@ describe ScenarioDefinition, "#any_number_of_times", :shared => true do
431
431
  end
432
432
  end
433
433
 
434
- describe ScenarioDefinition, "#any_number_of_times with returns block_callback_strategy" do
435
- it_should_behave_like "RR::ScenarioDefinition#any_number_of_times"
436
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
434
+ describe DoubleDefinition, "#any_number_of_times with returns block_callback_strategy" do
435
+ it_should_behave_like "RR::DoubleDefinition#any_number_of_times"
436
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
437
437
 
438
438
  it "sets return value when block passed in" do
439
439
  @return_value.should == :new_return_value
@@ -441,9 +441,9 @@ describe ScenarioDefinition, "#any_number_of_times with returns block_callback_s
441
441
  end
442
442
  end
443
443
 
444
- describe ScenarioDefinition, "#any_number_of_times with after_call block_callback_strategy" do
445
- it_should_behave_like "RR::ScenarioDefinition#any_number_of_times"
446
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
444
+ describe DoubleDefinition, "#any_number_of_times with after_call block_callback_strategy" do
445
+ it_should_behave_like "RR::DoubleDefinition#any_number_of_times"
446
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
447
447
 
448
448
  it "sets return value when block passed in" do
449
449
  @return_value.should == :new_return_value
@@ -451,15 +451,15 @@ describe ScenarioDefinition, "#any_number_of_times with after_call block_callbac
451
451
  end
452
452
  end
453
453
 
454
- describe ScenarioDefinition, "#ordered", :shared => true do
455
- it_should_behave_like "RR::ScenarioDefinition"
454
+ describe DoubleDefinition, "#ordered", :shared => true do
455
+ it_should_behave_like "RR::DoubleDefinition"
456
456
 
457
457
  it "adds itself to the ordered scenarios list" do
458
458
  @definition.ordered
459
459
  @space.ordered_scenarios.should include(@scenario)
460
460
  end
461
461
 
462
- it "does not double add itself" do
462
+ it "does not double_insertion add itself" do
463
463
  @definition.ordered
464
464
  @space.ordered_scenarios.should == [@scenario]
465
465
  end
@@ -468,15 +468,15 @@ describe ScenarioDefinition, "#ordered", :shared => true do
468
468
  @definition.should be_ordered
469
469
  end
470
470
 
471
- it "raises error when there is no Scenario" do
471
+ it "raises error when there is no Double" do
472
472
  @definition.scenario = nil
473
473
  proc do
474
474
  @definition.ordered
475
475
  end.should raise_error(
476
- Errors::ScenarioDefinitionError,
477
- "Scenario Definitions must have a dedicated Scenario to be ordered. " <<
476
+ Errors::DoubleDefinitionError,
477
+ "Double Definitions must have a dedicated Double to be ordered. " <<
478
478
  "For example, using instance_of does not allow ordered to be used. " <<
479
- "probe the class's #new method instead."
479
+ "proxy the class's #new method instead."
480
480
  )
481
481
  end
482
482
 
@@ -491,9 +491,9 @@ describe ScenarioDefinition, "#ordered", :shared => true do
491
491
  end
492
492
  end
493
493
 
494
- describe ScenarioDefinition, "#ordered with returns block_callback_strategy" do
495
- it_should_behave_like "RR::ScenarioDefinition#ordered"
496
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
494
+ describe DoubleDefinition, "#ordered with returns block_callback_strategy" do
495
+ it_should_behave_like "RR::DoubleDefinition#ordered"
496
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
497
497
 
498
498
  it "sets return value when block passed in" do
499
499
  @return_value.should == :new_return_value
@@ -501,9 +501,9 @@ describe ScenarioDefinition, "#ordered with returns block_callback_strategy" do
501
501
  end
502
502
  end
503
503
 
504
- describe ScenarioDefinition, "#ordered with after_call block_callback_strategy" do
505
- it_should_behave_like "RR::ScenarioDefinition#ordered"
506
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
504
+ describe DoubleDefinition, "#ordered with after_call block_callback_strategy" do
505
+ it_should_behave_like "RR::DoubleDefinition#ordered"
506
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
507
507
 
508
508
  it "sets return value when block passed in" do
509
509
  @return_value.should == :new_return_value
@@ -511,18 +511,18 @@ describe ScenarioDefinition, "#ordered with after_call block_callback_strategy"
511
511
  end
512
512
  end
513
513
 
514
- describe ScenarioDefinition, "#ordered?" do
515
- it_should_behave_like "RR::ScenarioDefinition"
514
+ describe DoubleDefinition, "#ordered?" do
515
+ it_should_behave_like "RR::DoubleDefinition"
516
516
 
517
517
  it "defaults to false" do
518
518
  @definition.should_not be_ordered
519
519
  end
520
520
  end
521
521
 
522
- describe ScenarioDefinition, "#yields", :shared => true do
523
- it_should_behave_like "RR::ScenarioDefinition"
522
+ describe DoubleDefinition, "#yields", :shared => true do
523
+ it_should_behave_like "RR::DoubleDefinition"
524
524
 
525
- it "returns ScenarioDefinition" do
525
+ it "returns DoubleDefinition" do
526
526
  @definition.yields(:baz).should === @definition
527
527
  end
528
528
 
@@ -546,9 +546,9 @@ describe ScenarioDefinition, "#yields", :shared => true do
546
546
  end
547
547
  end
548
548
 
549
- describe ScenarioDefinition, "#yields with returns block_callback_strategy" do
550
- it_should_behave_like "RR::ScenarioDefinition#yields"
551
- it_should_behave_like "RR::ScenarioDefinition with returns block_callback_strategy"
549
+ describe DoubleDefinition, "#yields with returns block_callback_strategy" do
550
+ it_should_behave_like "RR::DoubleDefinition#yields"
551
+ it_should_behave_like "RR::DoubleDefinition with returns block_callback_strategy"
552
552
 
553
553
  it "sets return value when block passed in" do
554
554
  @return_value.should == :new_return_value
@@ -558,9 +558,9 @@ describe ScenarioDefinition, "#yields with returns block_callback_strategy" do
558
558
  end
559
559
  end
560
560
 
561
- describe ScenarioDefinition, "#yields with after_call block_callback_strategy" do
562
- it_should_behave_like "RR::ScenarioDefinition#yields"
563
- it_should_behave_like "RR::ScenarioDefinition with after_call block_callback_strategy"
561
+ describe DoubleDefinition, "#yields with after_call block_callback_strategy" do
562
+ it_should_behave_like "RR::DoubleDefinition#yields"
563
+ it_should_behave_like "RR::DoubleDefinition with after_call block_callback_strategy"
564
564
 
565
565
  it "sets return value when block passed in" do
566
566
  @return_value.should == :new_return_value
@@ -568,14 +568,14 @@ describe ScenarioDefinition, "#yields with after_call block_callback_strategy" d
568
568
  end
569
569
  end
570
570
 
571
- describe ScenarioDefinition, "#after_call" do
572
- it_should_behave_like "RR::ScenarioDefinition"
571
+ describe DoubleDefinition, "#after_call" do
572
+ it_should_behave_like "RR::DoubleDefinition"
573
573
 
574
- it "returns ScenarioDefinition" do
574
+ it "returns DoubleDefinition" do
575
575
  @definition.after_call {}.should === @definition
576
576
  end
577
577
 
578
- it "sends return value of Scenario implementation to after_call" do
578
+ it "sends return value of Double implementation to after_call" do
579
579
  return_value = {}
580
580
  @definition.with_any_args.returns(return_value).after_call do |value|
581
581
  value[:foo] = :bar
@@ -614,10 +614,10 @@ describe ScenarioDefinition, "#after_call" do
614
614
  end
615
615
  end
616
616
 
617
- describe ScenarioDefinition, "#returns" do
618
- it_should_behave_like "RR::ScenarioDefinition"
617
+ describe DoubleDefinition, "#returns" do
618
+ it_should_behave_like "RR::DoubleDefinition"
619
619
 
620
- it "returns ScenarioDefinition" do
620
+ it "returns DoubleDefinition" do
621
621
  @definition.returns {:baz}.should === @definition
622
622
  @definition.returns(:baz).should === @definition
623
623
  end
@@ -644,10 +644,10 @@ describe ScenarioDefinition, "#returns" do
644
644
  end
645
645
  end
646
646
 
647
- describe ScenarioDefinition, "#implemented_by" do
648
- it_should_behave_like "RR::ScenarioDefinition"
647
+ describe DoubleDefinition, "#implemented_by" do
648
+ it_should_behave_like "RR::DoubleDefinition"
649
649
 
650
- it "returns the ScenarioDefinition" do
650
+ it "returns the DoubleDefinition" do
651
651
  @definition.implemented_by(proc{:baz}).should === @definition
652
652
  end
653
653
 
@@ -665,10 +665,10 @@ describe ScenarioDefinition, "#implemented_by" do
665
665
  end
666
666
  end
667
667
 
668
- describe ScenarioDefinition, "#implemented_by_original_method" do
669
- it_should_behave_like "RR::ScenarioDefinition"
668
+ describe DoubleDefinition, "#implemented_by_original_method" do
669
+ it_should_behave_like "RR::DoubleDefinition"
670
670
 
671
- it "returns the ScenarioDefinition object" do
671
+ it "returns the DoubleDefinition object" do
672
672
  @definition.implemented_by_original_method.should === @definition
673
673
  end
674
674
 
@@ -683,8 +683,8 @@ describe ScenarioDefinition, "#implemented_by_original_method" do
683
683
  "method_missing for #{method_name}(#{args.inspect})"
684
684
  end
685
685
  end
686
- double = @space.double(@object, :does_not_exist)
687
- scenario = @space.scenario(double)
686
+ double_insertion = @space.double_insertion(@object, :does_not_exist)
687
+ scenario = @space.scenario(double_insertion)
688
688
  scenario.with_any_args
689
689
  scenario.implemented_by_original_method
690
690
 
@@ -693,8 +693,8 @@ describe ScenarioDefinition, "#implemented_by_original_method" do
693
693
  end
694
694
  end
695
695
 
696
- describe ScenarioDefinition, "#exact_match?" do
697
- it_should_behave_like "RR::ScenarioDefinition"
696
+ describe DoubleDefinition, "#exact_match?" do
697
+ it_should_behave_like "RR::DoubleDefinition"
698
698
 
699
699
  it "returns false when no expectation set" do
700
700
  @definition.should_not be_exact_match()
@@ -717,8 +717,8 @@ describe ScenarioDefinition, "#exact_match?" do
717
717
  end
718
718
  end
719
719
 
720
- describe ScenarioDefinition, "#wildcard_match?" do
721
- it_should_behave_like "RR::ScenarioDefinition"
720
+ describe DoubleDefinition, "#wildcard_match?" do
721
+ it_should_behave_like "RR::DoubleDefinition"
722
722
 
723
723
  it "returns false when no expectation set" do
724
724
  @definition.should_not be_wildcard_match()
@@ -747,8 +747,8 @@ describe ScenarioDefinition, "#wildcard_match?" do
747
747
  end
748
748
  end
749
749
 
750
- describe ScenarioDefinition, "#terminal?" do
751
- it_should_behave_like "RR::ScenarioDefinition"
750
+ describe DoubleDefinition, "#terminal?" do
751
+ it_should_behave_like "RR::DoubleDefinition"
752
752
 
753
753
  it "returns true when times_matcher's terminal? is true" do
754
754
  @definition.once
@@ -768,8 +768,8 @@ describe ScenarioDefinition, "#terminal?" do
768
768
  end
769
769
  end
770
770
 
771
- describe ScenarioDefinition, "#expected_arguments" do
772
- it_should_behave_like "RR::ScenarioDefinition"
771
+ describe DoubleDefinition, "#expected_arguments" do
772
+ it_should_behave_like "RR::DoubleDefinition"
773
773
 
774
774
  it "returns argument expectation's expected_arguments when there is a argument expectation" do
775
775
  @definition.with(1, 2)
@@ -782,16 +782,16 @@ describe ScenarioDefinition, "#expected_arguments" do
782
782
  end
783
783
  end
784
784
 
785
- describe ScenarioDefinition, "#block_callback_strategy" do
786
- it_should_behave_like "RR::ScenarioDefinition"
785
+ describe DoubleDefinition, "#block_callback_strategy" do
786
+ it_should_behave_like "RR::DoubleDefinition"
787
787
 
788
788
  it "defaults to :returns" do
789
789
  @definition.block_callback_strategy.should == :returns
790
790
  end
791
791
  end
792
792
 
793
- describe ScenarioDefinition, "#returns_block_callback_strategy!" do
794
- it_should_behave_like "RR::ScenarioDefinition"
793
+ describe DoubleDefinition, "#returns_block_callback_strategy!" do
794
+ it_should_behave_like "RR::DoubleDefinition"
795
795
 
796
796
  it "sets the block_callback_strategy to :returns" do
797
797
  @definition.returns_block_callback_strategy!
@@ -799,8 +799,8 @@ describe ScenarioDefinition, "#returns_block_callback_strategy!" do
799
799
  end
800
800
  end
801
801
 
802
- describe ScenarioDefinition, "#after_call_block_callback_strategy!" do
803
- it_should_behave_like "RR::ScenarioDefinition"
802
+ describe DoubleDefinition, "#after_call_block_callback_strategy!" do
803
+ it_should_behave_like "RR::DoubleDefinition"
804
804
 
805
805
  it "sets the block_callback_strategy to :after_call" do
806
806
  @definition.after_call_block_callback_strategy!