rr 0.3.11 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +8 -3
- data/README +130 -39
- data/Rakefile +6 -5
- data/lib/rr.rb +8 -8
- data/lib/rr/adapters/rr_methods.rb +228 -0
- data/lib/rr/adapters/rspec.rb +1 -1
- data/lib/rr/adapters/test_unit.rb +1 -1
- data/lib/rr/double.rb +294 -89
- data/lib/rr/{scenario_creator.rb → double_creator.rb} +65 -66
- data/lib/rr/{scenario_definition.rb → double_definition.rb} +36 -36
- data/lib/rr/{scenario_definition_builder.rb → double_definition_builder.rb} +3 -3
- data/lib/rr/double_insertion.rb +132 -0
- data/lib/rr/{scenario_matches.rb → double_matches.rb} +2 -2
- data/lib/rr/{scenario_method_proxy.rb → double_method_proxy.rb} +2 -2
- data/lib/rr/errors/argument_equality_error.rb +3 -3
- data/lib/rr/errors/rr_error.rb +13 -13
- data/lib/rr/errors/scenario_definition_error.rb +3 -3
- data/lib/rr/errors/scenario_not_found_error.rb +3 -3
- data/lib/rr/errors/scenario_order_error.rb +3 -3
- data/lib/rr/errors/times_called_error.rb +3 -3
- data/lib/rr/expectations/any_argument_expectation.rb +1 -1
- data/lib/rr/expectations/argument_equality_expectation.rb +1 -1
- data/lib/rr/expectations/times_called_expectation.rb +1 -1
- data/lib/rr/hash_with_object_id_key.rb +1 -1
- data/lib/rr/space.rb +40 -40
- data/lib/rr/times_called_matchers/any_times_matcher.rb +13 -13
- data/lib/rr/times_called_matchers/at_least_matcher.rb +11 -11
- data/lib/rr/times_called_matchers/at_most_matcher.rb +16 -16
- data/lib/rr/times_called_matchers/integer_matcher.rb +13 -13
- data/lib/rr/times_called_matchers/non_terminal.rb +21 -21
- data/lib/rr/times_called_matchers/proc_matcher.rb +7 -7
- data/lib/rr/times_called_matchers/range_matcher.rb +14 -14
- data/lib/rr/times_called_matchers/terminal.rb +16 -16
- data/lib/rr/times_called_matchers/times_called_matcher.rb +32 -32
- data/spec/core_spec_suite.rb +18 -0
- data/{examples → spec}/environment_fixture_setup.rb +0 -1
- data/{examples/high_level_example.rb → spec/high_level_spec.rb} +11 -11
- data/spec/rr/adapters/rr_methods_argument_matcher_spec.rb +67 -0
- data/spec/rr/adapters/rr_methods_creator_spec.rb +365 -0
- data/spec/rr/adapters/rr_methods_space_spec.rb +134 -0
- data/spec/rr/adapters/rr_methods_spec_helper.rb +11 -0
- data/{examples/rr/extensions/instance_methods_times_matcher_example.rb → spec/rr/adapters/rr_methods_times_matcher_spec.rb} +4 -4
- data/spec/rr/double/double_insertion_bind_spec.rb +78 -0
- data/spec/rr/double/double_insertion_dispatching_spec.rb +221 -0
- data/spec/rr/double/double_insertion_has_original_method_spec.rb +56 -0
- data/spec/rr/double/double_insertion_register_scenario_spec.rb +24 -0
- data/spec/rr/double/double_insertion_reset_spec.rb +89 -0
- data/spec/rr/double/double_insertion_spec.rb +66 -0
- data/spec/rr/double/double_insertion_verify_spec.rb +23 -0
- data/spec/rr/double_creator_spec.rb +454 -0
- data/{examples/rr/scenario_definition_example.rb → spec/rr/double_definition_spec.rb} +143 -143
- data/spec/rr/double_method_proxy_spec.rb +71 -0
- data/spec/rr/double_spec.rb +654 -0
- data/spec/rr/errors/rr_error_spec.rb +65 -0
- data/spec/rr/expectations/any_argument_expectation_spec.rb +47 -0
- data/spec/rr/expectations/anything_argument_equality_expectation_spec.rb +38 -0
- data/spec/rr/expectations/argument_equality_expectation_spec.rb +58 -0
- data/spec/rr/expectations/boolean_argument_equality_expectation_spec.rb +53 -0
- data/spec/rr/expectations/duck_type_argument_equality_expectation_spec.rb +71 -0
- data/spec/rr/expectations/is_a_argument_equality_expectation_spec.rb +51 -0
- data/spec/rr/expectations/numeric_argument_equality_expectation_spec.rb +47 -0
- data/spec/rr/expectations/range_argument_equality_expectation_spec.rb +59 -0
- data/spec/rr/expectations/regexp_argument_equality_expectation_spec.rb +72 -0
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb +43 -0
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb +67 -0
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_most_spec.rb +71 -0
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +21 -0
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_integer_spec.rb +103 -0
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_proc_spec.rb +79 -0
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb +81 -0
- data/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb +40 -0
- data/spec/rr/rspec/rspec_adapter_spec.rb +65 -0
- data/spec/rr/rspec/rspec_backtrace_tweaking_spec.rb +52 -0
- data/spec/rr/rspec/rspec_usage_spec.rb +67 -0
- data/spec/rr/space/hash_with_object_id_key_spec.rb +88 -0
- data/spec/rr/space/space_create_spec.rb +278 -0
- data/spec/rr/space/space_helper.rb +7 -0
- data/spec/rr/space/space_register_spec.rb +32 -0
- data/spec/rr/space/space_reset_spec.rb +131 -0
- data/spec/rr/space/space_spec.rb +32 -0
- data/spec/rr/space/space_verify_spec.rb +181 -0
- data/{examples → spec}/rr/test_unit/test_helper.rb +1 -1
- data/{examples → spec}/rr/test_unit/test_unit_backtrace_test.rb +0 -0
- data/{examples → spec}/rr/test_unit/test_unit_integration_test.rb +4 -4
- data/spec/rr/times_called_matchers/any_times_matcher_spec.rb +47 -0
- data/spec/rr/times_called_matchers/at_least_matcher_spec.rb +55 -0
- data/spec/rr/times_called_matchers/at_most_matcher_spec.rb +70 -0
- data/spec/rr/times_called_matchers/integer_matcher_spec.rb +70 -0
- data/spec/rr/times_called_matchers/proc_matcher_spec.rb +55 -0
- data/spec/rr/times_called_matchers/range_matcher_spec.rb +76 -0
- data/spec/rr/times_called_matchers/times_called_matcher_spec.rb +118 -0
- data/spec/rspec_spec_suite.rb +16 -0
- data/spec/spec_helper.rb +9 -0
- data/{examples/example_suite.rb → spec/spec_suite.rb} +3 -3
- data/{examples/test_unit_example_suite.rb → spec/test_unit_spec_suite.rb} +0 -0
- metadata +93 -93
- data/examples/core_example_suite.rb +0 -31
- data/examples/example_helper.rb +0 -9
- data/examples/rr/double/double_bind_example.rb +0 -70
- data/examples/rr/double/double_dispatching_example.rb +0 -236
- data/examples/rr/double/double_example.rb +0 -66
- data/examples/rr/double/double_has_original_method_example.rb +0 -56
- data/examples/rr/double/double_register_scenario_example.rb +0 -24
- data/examples/rr/double/double_reset_example.rb +0 -89
- data/examples/rr/double/double_verify_example.rb +0 -23
- data/examples/rr/errors/rr_error_example.rb +0 -65
- data/examples/rr/expectations/any_argument_expectation_example.rb +0 -52
- data/examples/rr/expectations/anything_argument_equality_expectation_example.rb +0 -38
- data/examples/rr/expectations/argument_equality_expectation_example.rb +0 -62
- data/examples/rr/expectations/boolean_argument_equality_expectation_example.rb +0 -48
- data/examples/rr/expectations/duck_type_argument_equality_expectation_example.rb +0 -67
- data/examples/rr/expectations/is_a_argument_equality_expectation_example.rb +0 -50
- data/examples/rr/expectations/numeric_argument_equality_expectation_example.rb +0 -46
- data/examples/rr/expectations/range_argument_equality_expectation_example.rb +0 -59
- data/examples/rr/expectations/regexp_argument_equality_expectation_example.rb +0 -67
- data/examples/rr/expectations/times_called_expectation/times_called_expectation_any_times_example.rb +0 -50
- data/examples/rr/expectations/times_called_expectation/times_called_expectation_at_least_example.rb +0 -73
- data/examples/rr/expectations/times_called_expectation/times_called_expectation_at_most_example.rb +0 -77
- data/examples/rr/expectations/times_called_expectation/times_called_expectation_example.rb +0 -42
- data/examples/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +0 -20
- data/examples/rr/expectations/times_called_expectation/times_called_expectation_integer_example.rb +0 -111
- data/examples/rr/expectations/times_called_expectation/times_called_expectation_proc_example.rb +0 -88
- data/examples/rr/expectations/times_called_expectation/times_called_expectation_range_example.rb +0 -90
- data/examples/rr/extensions/instance_methods_argument_matcher_example.rb +0 -65
- data/examples/rr/extensions/instance_methods_creator_example.rb +0 -363
- data/examples/rr/extensions/instance_methods_example_helper.rb +0 -11
- data/examples/rr/extensions/instance_methods_space_example.rb +0 -122
- data/examples/rr/rspec/rspec_adapter_example.rb +0 -63
- data/examples/rr/rspec/rspec_backtrace_tweaking_example.rb +0 -36
- data/examples/rr/rspec/rspec_usage_example.rb +0 -65
- data/examples/rr/scenario_creator_example.rb +0 -459
- data/examples/rr/scenario_example.rb +0 -701
- data/examples/rr/scenario_method_proxy_example.rb +0 -71
- data/examples/rr/space/hash_with_object_id_key_example.rb +0 -86
- data/examples/rr/space/space_create_example.rb +0 -278
- data/examples/rr/space/space_example.rb +0 -29
- data/examples/rr/space/space_helper.rb +0 -7
- data/examples/rr/space/space_register_example.rb +0 -32
- data/examples/rr/space/space_reset_example.rb +0 -120
- data/examples/rr/space/space_verify_example.rb +0 -169
- data/examples/rr/times_called_matchers/any_times_matcher_example.rb +0 -63
- data/examples/rr/times_called_matchers/at_least_matcher_example.rb +0 -70
- data/examples/rr/times_called_matchers/at_most_matcher_example.rb +0 -85
- data/examples/rr/times_called_matchers/integer_matcher_example.rb +0 -91
- data/examples/rr/times_called_matchers/proc_matcher_example.rb +0 -77
- data/examples/rr/times_called_matchers/range_matcher_example.rb +0 -97
- data/examples/rr/times_called_matchers/times_called_matcher_example.rb +0 -53
- data/examples/rspec_example_suite.rb +0 -25
- data/lib/rr/extensions/instance_methods.rb +0 -228
- data/lib/rr/scenario.rb +0 -337
@@ -1,13 +1,13 @@
|
|
1
|
-
require "
|
1
|
+
require "spec/spec_helper"
|
2
2
|
|
3
3
|
module RR
|
4
|
-
describe
|
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
|
-
@
|
10
|
-
@scenario = @space.scenario(@
|
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
|
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
|
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
|
37
|
-
it_should_behave_like "RR::
|
36
|
+
describe DoubleDefinition, "#with", :shared => true do
|
37
|
+
it_should_behave_like "RR::DoubleDefinition"
|
38
38
|
|
39
|
-
it "returns
|
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
|
61
|
-
it_should_behave_like "RR::
|
62
|
-
it_should_behave_like "RR::
|
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
|
71
|
-
it_should_behave_like "RR::
|
72
|
-
it_should_behave_like "RR::
|
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
|
81
|
-
it_should_behave_like "RR::
|
80
|
+
describe DoubleDefinition, "#with_any_args", :shared => true do
|
81
|
+
it_should_behave_like "RR::DoubleDefinition"
|
82
82
|
|
83
|
-
it "returns
|
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
|
104
|
-
it_should_behave_like "RR::
|
105
|
-
it_should_behave_like "RR::
|
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
|
114
|
-
it_should_behave_like "RR::
|
115
|
-
it_should_behave_like "RR::
|
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
|
124
|
-
it_should_behave_like "RR::
|
123
|
+
describe DoubleDefinition, "#with_no_args", :shared => true do
|
124
|
+
it_should_behave_like "RR::DoubleDefinition"
|
125
125
|
|
126
|
-
it "returns
|
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
|
152
|
-
it_should_behave_like "RR::
|
153
|
-
it_should_behave_like "RR::
|
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
|
162
|
-
it_should_behave_like "RR::
|
163
|
-
it_should_behave_like "RR::
|
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
|
172
|
-
it_should_behave_like "RR::
|
171
|
+
describe DoubleDefinition, "#never" do
|
172
|
+
it_should_behave_like "RR::DoubleDefinition"
|
173
173
|
|
174
|
-
it "returns
|
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
|
191
|
-
it_should_behave_like "RR::
|
190
|
+
describe DoubleDefinition, "#once", :shared => true do
|
191
|
+
it_should_behave_like "RR::DoubleDefinition"
|
192
192
|
|
193
|
-
it "returns
|
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
|
213
|
-
it_should_behave_like "RR::
|
214
|
-
it_should_behave_like "RR::
|
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
|
223
|
-
it_should_behave_like "RR::
|
224
|
-
it_should_behave_like "RR::
|
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
|
233
|
-
it_should_behave_like "RR::
|
232
|
+
describe DoubleDefinition, "#twice", :shared => true do
|
233
|
+
it_should_behave_like "RR::DoubleDefinition"
|
234
234
|
|
235
|
-
it "returns
|
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
|
257
|
-
it_should_behave_like "RR::
|
258
|
-
it_should_behave_like "RR::
|
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
|
267
|
-
it_should_behave_like "RR::
|
268
|
-
it_should_behave_like "RR::
|
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
|
277
|
-
it_should_behave_like "RR::
|
276
|
+
describe DoubleDefinition, "#at_least", :shared => true do
|
277
|
+
it_should_behave_like "RR::DoubleDefinition"
|
278
278
|
|
279
|
-
it "returns
|
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
|
300
|
-
it_should_behave_like "RR::
|
301
|
-
it_should_behave_like "RR::
|
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
|
310
|
-
it_should_behave_like "RR::
|
311
|
-
it_should_behave_like "RR::
|
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
|
320
|
-
it_should_behave_like "RR::
|
319
|
+
describe DoubleDefinition, "#at_most", :shared => true do
|
320
|
+
it_should_behave_like "RR::DoubleDefinition"
|
321
321
|
|
322
|
-
it "returns
|
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
|
348
|
-
it_should_behave_like "RR::
|
349
|
-
it_should_behave_like "RR::
|
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
|
358
|
-
it_should_behave_like "RR::
|
359
|
-
it_should_behave_like "RR::
|
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
|
368
|
-
it_should_behave_like "RR::
|
367
|
+
describe DoubleDefinition, "#times", :shared => true do
|
368
|
+
it_should_behave_like "RR::DoubleDefinition"
|
369
369
|
|
370
|
-
it "returns
|
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
|
392
|
-
it_should_behave_like "RR::
|
393
|
-
it_should_behave_like "RR::
|
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
|
402
|
-
it_should_behave_like "RR::
|
403
|
-
it_should_behave_like "RR::
|
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
|
412
|
-
it_should_behave_like "RR::
|
411
|
+
describe DoubleDefinition, "#any_number_of_times", :shared => true do
|
412
|
+
it_should_behave_like "RR::DoubleDefinition"
|
413
413
|
|
414
|
-
it "returns
|
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
|
435
|
-
it_should_behave_like "RR::
|
436
|
-
it_should_behave_like "RR::
|
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
|
445
|
-
it_should_behave_like "RR::
|
446
|
-
it_should_behave_like "RR::
|
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
|
455
|
-
it_should_behave_like "RR::
|
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
|
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
|
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::
|
477
|
-
"
|
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
|
-
"
|
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
|
495
|
-
it_should_behave_like "RR::
|
496
|
-
it_should_behave_like "RR::
|
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
|
505
|
-
it_should_behave_like "RR::
|
506
|
-
it_should_behave_like "RR::
|
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
|
515
|
-
it_should_behave_like "RR::
|
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
|
523
|
-
it_should_behave_like "RR::
|
522
|
+
describe DoubleDefinition, "#yields", :shared => true do
|
523
|
+
it_should_behave_like "RR::DoubleDefinition"
|
524
524
|
|
525
|
-
it "returns
|
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
|
550
|
-
it_should_behave_like "RR::
|
551
|
-
it_should_behave_like "RR::
|
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
|
562
|
-
it_should_behave_like "RR::
|
563
|
-
it_should_behave_like "RR::
|
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
|
572
|
-
it_should_behave_like "RR::
|
571
|
+
describe DoubleDefinition, "#after_call" do
|
572
|
+
it_should_behave_like "RR::DoubleDefinition"
|
573
573
|
|
574
|
-
it "returns
|
574
|
+
it "returns DoubleDefinition" do
|
575
575
|
@definition.after_call {}.should === @definition
|
576
576
|
end
|
577
577
|
|
578
|
-
it "sends return value of
|
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
|
618
|
-
it_should_behave_like "RR::
|
617
|
+
describe DoubleDefinition, "#returns" do
|
618
|
+
it_should_behave_like "RR::DoubleDefinition"
|
619
619
|
|
620
|
-
it "returns
|
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
|
648
|
-
it_should_behave_like "RR::
|
647
|
+
describe DoubleDefinition, "#implemented_by" do
|
648
|
+
it_should_behave_like "RR::DoubleDefinition"
|
649
649
|
|
650
|
-
it "returns the
|
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
|
669
|
-
it_should_behave_like "RR::
|
668
|
+
describe DoubleDefinition, "#implemented_by_original_method" do
|
669
|
+
it_should_behave_like "RR::DoubleDefinition"
|
670
670
|
|
671
|
-
it "returns the
|
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
|
-
|
687
|
-
scenario = @space.scenario(
|
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
|
697
|
-
it_should_behave_like "RR::
|
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
|
721
|
-
it_should_behave_like "RR::
|
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
|
751
|
-
it_should_behave_like "RR::
|
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
|
772
|
-
it_should_behave_like "RR::
|
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
|
786
|
-
it_should_behave_like "RR::
|
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
|
794
|
-
it_should_behave_like "RR::
|
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
|
803
|
-
it_should_behave_like "RR::
|
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!
|