rr 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGES +7 -0
  2. data/Rakefile +1 -1
  3. data/examples/example_helper.rb +1 -1
  4. data/examples/rr/{double_bind_example.rb → double/double_bind_example.rb} +0 -0
  5. data/examples/rr/{double_dispatching_example.rb → double/double_dispatching_example.rb} +72 -37
  6. data/examples/rr/{double_example.rb → double/double_example.rb} +0 -0
  7. data/examples/rr/{double_register_scenario_example.rb → double/double_register_scenario_example.rb} +0 -0
  8. data/examples/rr/{double_reset_example.rb → double/double_reset_example.rb} +0 -0
  9. data/examples/rr/{double_verify_example.rb → double/double_verify_example.rb} +0 -0
  10. data/examples/rr/expectations/times_called_expectation/times_called_expectation_any_times_example.rb +8 -0
  11. data/examples/rr/expectations/times_called_expectation/times_called_expectation_at_least_example.rb +8 -0
  12. data/examples/rr/expectations/times_called_expectation/times_called_expectation_at_most_example.rb +8 -0
  13. data/examples/rr/expectations/times_called_expectation/times_called_expectation_integer_example.rb +9 -1
  14. data/examples/rr/expectations/times_called_expectation/times_called_expectation_proc_example.rb +8 -0
  15. data/examples/rr/expectations/times_called_expectation/times_called_expectation_range_example.rb +9 -1
  16. data/examples/rr/scenario_example.rb +26 -6
  17. data/examples/rr/{space_create_example.rb → space/space_create_example.rb} +0 -0
  18. data/examples/rr/{space_example.rb → space/space_example.rb} +0 -0
  19. data/examples/rr/{space_helper.rb → space/space_helper.rb} +0 -0
  20. data/examples/rr/{space_register_example.rb → space/space_register_example.rb} +0 -0
  21. data/examples/rr/{space_reset_example.rb → space/space_reset_example.rb} +0 -0
  22. data/examples/rr/{space_verify_example.rb → space/space_verify_example.rb} +24 -6
  23. data/examples/rr/times_called_matchers/any_times_matcher_example.rb +19 -13
  24. data/examples/rr/times_called_matchers/at_least_matcher_example.rb +19 -16
  25. data/examples/rr/times_called_matchers/at_most_matcher_example.rb +19 -16
  26. data/examples/rr/times_called_matchers/integer_matcher_example.rb +19 -16
  27. data/examples/rr/times_called_matchers/proc_matcher_example.rb +19 -16
  28. data/examples/rr/times_called_matchers/range_matcher_example.rb +19 -16
  29. data/lib/rr.rb +5 -4
  30. data/lib/rr/double.rb +30 -15
  31. data/lib/rr/expectations/times_called_expectation.rb +4 -0
  32. data/lib/rr/scenario.rb +5 -0
  33. data/lib/rr/scenario_matches.rb +51 -0
  34. data/lib/rr/space.rb +5 -1
  35. data/lib/rr/times_called_matchers/any_times_matcher.rb +2 -8
  36. data/lib/rr/times_called_matchers/at_least_matcher.rb +2 -8
  37. data/lib/rr/times_called_matchers/at_most_matcher.rb +2 -0
  38. data/lib/rr/times_called_matchers/integer_matcher.rb +2 -0
  39. data/lib/rr/times_called_matchers/non_terminal.rb +27 -0
  40. data/lib/rr/times_called_matchers/proc_matcher.rb +2 -8
  41. data/lib/rr/times_called_matchers/range_matcher.rb +2 -0
  42. data/lib/rr/times_called_matchers/terminal.rb +20 -0
  43. metadata +17 -14
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ * 0.1.14
2
+ - Introduced concept of Terminal and NonTerminal TimesCalledMatchers
3
+ - Doubles that can be called many times can be replaced
4
+ - Terminal Scenarios are called before NonTerminal Scenarios
5
+ - Error message tweaking
6
+ - Raise error when making a Scenarios with NonDeterministic TimesMatcher Ordered
7
+
1
8
  * 0.1.13
2
9
  - Fixed [#12290] Scenario#returns with false causes a return value of nil
3
10
 
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ def run_suite
21
21
  end
22
22
 
23
23
  PKG_NAME = "rr"
24
- PKG_VERSION = "0.1.13"
24
+ PKG_VERSION = "0.1.14"
25
25
  PKG_FILES = FileList[
26
26
  '[A-Z]*',
27
27
  '*.rb',
@@ -1,6 +1,6 @@
1
1
  dir = File.dirname(__FILE__)
2
2
  require "#{dir}/environment_fixture_setup"
3
- require "examples/rr/space_helper"
3
+ require "examples/rr/space/space_helper"
4
4
  require "examples/rr/expectations/times_called_expectation/times_called_expectation_helper"
5
5
  require "examples/rr/extensions/double_methods_example_helper"
6
6
 
@@ -97,52 +97,83 @@ describe Double, " method dispatching where there are scenarios" do
97
97
 
98
98
  proc {@object.foobar(:arg1, :arg2)}.should raise_error(
99
99
  Errors::ScenarioNotFoundError,
100
- "No scenario for foobar(:arg1, :arg2)\n" <<
101
- "in\n" <<
100
+ "No scenario for foobar(:arg1, :arg2) in\n" <<
102
101
  "- foobar(1, 2)\n" <<
103
102
  "- foobar(3)"
104
103
  )
105
104
  end
106
105
  end
107
106
 
108
- describe Double, " method dispatching where there are scenarios with duplicate Exact Match ArgumentExpectations" do
107
+ describe Double, " method dispatching where there are Scenarios with NonTerminal TimesCalledMatchers" do
108
+ it_should_behave_like "RR::Double method dispatching"
109
+
110
+ it "dispatches to Scenario with exact match" do
111
+ scenario = create_scenario(1, 2) {:return_value}
112
+ @object.foobar(1, 2).should == :return_value
113
+ end
114
+
115
+ it "matches to the last Scenario that was registered with an exact match" do
116
+ scenario_1 = create_scenario(1, 2) {:value_1}
117
+ scenario_2 = create_scenario(1, 2) {:value_2}
118
+
119
+ @object.foobar(1, 2).should == :value_2
120
+ end
121
+
122
+ it "dispatches to Scenario with wildcard match" do
123
+ scenario = create_scenario(anything) {:return_value}
124
+ @object.foobar(:dont_care).should == :return_value
125
+ end
126
+
127
+ it "matches to the last Scenario that was registered with a wildcard match" do
128
+ scenario_1 = create_scenario(anything) {:value_1}
129
+ scenario_2 = create_scenario(anything) {:value_2}
130
+
131
+ @object.foobar(:dont_care).should == :value_2
132
+ end
133
+
134
+ it "matches to Scenario with exact match Scenario even when a Scenario with wildcard match was registered later" do
135
+ exact_scenario_registered_first = create_scenario(1, 2) {:exact_first}
136
+ wildcard_scenario_registered_last = create_scenario(anything, anything) {:wildcard_last}
137
+
138
+ @object.foobar(1, 2).should == :exact_first
139
+ end
140
+
141
+ def create_scenario(*arguments, &return_value)
142
+ scenario = @space.create_scenario(@double)
143
+ scenario.with(*arguments).any_number_of_times.returns(&return_value)
144
+ scenario.should_not be_terminal
145
+ scenario
146
+ end
147
+ end
148
+
149
+ describe Double, " method dispatching where there are Terminal Scenarios with duplicate Exact Match ArgumentExpectations" do
109
150
  it_should_behave_like "RR::Double method dispatching"
110
151
 
111
152
  it "dispatches to Scenario that have an exact match" do
112
- scenario1_with_exact_match = @space.create_scenario(@double)
113
- scenario1_with_exact_match.with(:exact_match).returns {:return_1}
153
+ scenario1_with_exact_match = create_scenario(:exact_match) {:return_1}
114
154
 
115
155
  @object.foobar(:exact_match).should == :return_1
116
156
  end
117
157
 
118
158
  it "dispatches to the first Scenario that have an exact match" do
119
- scenario1_with_exact_match = @space.create_scenario(@double)
120
- scenario1_with_exact_match.with(:exact_match).returns {:return_1}
121
-
122
- scenario2_with_exact_match = @space.create_scenario(@double)
123
- scenario2_with_exact_match.with(:exact_match).returns {:return_2}
159
+ scenario1_with_exact_match = create_scenario(:exact_match) {:return_1}
160
+ scenario2_with_exact_match = create_scenario(:exact_match) {:return_2}
124
161
 
125
162
  @object.foobar(:exact_match).should == :return_1
126
163
  end
127
164
 
128
165
  it "dispatches the second Scenario with an exact match
129
166
  when the first scenario's Times Called expectation is satisfied" do
130
- scenario1_with_exact_match = @space.create_scenario(@double)
131
- scenario1_with_exact_match.with(:exact_match).returns {:return_1}.once
132
-
133
- scenario2_with_exact_match = @space.create_scenario(@double)
134
- scenario2_with_exact_match.with(:exact_match).returns {:return_2}.once
167
+ scenario1_with_exact_match = create_scenario(:exact_match) {:return_1}
168
+ scenario2_with_exact_match = create_scenario(:exact_match) {:return_2}
135
169
 
136
170
  @object.foobar(:exact_match)
137
171
  @object.foobar(:exact_match).should == :return_2
138
172
  end
139
173
 
140
174
  it "raises TimesCalledError when all of the scenarios Times Called expectation is satisfied" do
141
- scenario1_with_exact_match = @space.create_scenario(@double)
142
- scenario1_with_exact_match.with(:exact_match).returns {:return_1}.once
143
-
144
- scenario2_with_exact_match = @space.create_scenario(@double)
145
- scenario2_with_exact_match.with(:exact_match).returns {:return_2}.once
175
+ scenario1_with_exact_match = create_scenario(:exact_match) {:return_1}
176
+ scenario2_with_exact_match = create_scenario(:exact_match) {:return_2}
146
177
 
147
178
  @object.foobar(:exact_match)
148
179
  @object.foobar(:exact_match)
@@ -150,46 +181,43 @@ describe Double, " method dispatching where there are scenarios with duplicate E
150
181
  @object.foobar(:exact_match)
151
182
  end.should raise_error(Errors::TimesCalledError)
152
183
  end
184
+
185
+ def create_scenario(*arguments, &return_value)
186
+ scenario = @space.create_scenario(@double)
187
+ scenario.with(*arguments).once.returns(&return_value)
188
+ scenario.should be_terminal
189
+ scenario
190
+ end
153
191
  end
154
192
 
155
193
  describe Double, " method dispatching where there are scenarios with duplicate Wildcard Match ArgumentExpectations" do
156
194
  it_should_behave_like "RR::Double method dispatching"
157
195
 
158
196
  it "dispatches to Scenario that have a wildcard match" do
159
- scenario_1 = @space.create_scenario(@double)
160
- scenario_1.with_any_args.returns {:return_1}
197
+ scenario_1 = create_scenario {:return_1}
161
198
 
162
199
  @object.foobar(:anything).should == :return_1
163
200
  end
164
201
 
165
202
  it "dispatches to the first Scenario that has a wildcard match" do
166
- scenario_1 = @space.create_scenario(@double)
167
- scenario_1.with_any_args.returns {:return_1}
168
-
169
- scenario_2 = @space.create_scenario(@double)
170
- scenario_2.with_any_args.returns {:return_2}
203
+ scenario_1 = create_scenario {:return_1}
204
+ scenario_2 = create_scenario {:return_2}
171
205
 
172
206
  @object.foobar(:anything).should == :return_1
173
207
  end
174
208
 
175
209
  it "dispatches the second Scenario with a wildcard match
176
210
  when the first scenario's Times Called expectation is satisfied" do
177
- scenario_1 = @space.create_scenario(@double)
178
- scenario_1.with_any_args.returns {:return_1}.once
179
-
180
- scenario_2 = @space.create_scenario(@double)
181
- scenario_2.with_any_args.returns {:return_2}.once
211
+ scenario_1 = create_scenario {:return_1}
212
+ scenario_2 = create_scenario {:return_2}
182
213
 
183
214
  @object.foobar(:anything)
184
215
  @object.foobar(:anything).should == :return_2
185
216
  end
186
217
 
187
218
  it "raises TimesCalledError when all of the scenarios Times Called expectation is satisfied" do
188
- scenario_1 = @space.create_scenario(@double)
189
- scenario_1.with_any_args.returns {:return_1}.once
190
-
191
- scenario_2 = @space.create_scenario(@double)
192
- scenario_2.with_any_args.returns {:return_2}.once
219
+ scenario_1 = create_scenario {:return_1}
220
+ scenario_2 = create_scenario {:return_2}
193
221
 
194
222
  @object.foobar(:anything)
195
223
  @object.foobar(:anything)
@@ -197,5 +225,12 @@ describe Double, " method dispatching where there are scenarios with duplicate W
197
225
  @object.foobar(:anything)
198
226
  end.should raise_error(Errors::TimesCalledError)
199
227
  end
228
+
229
+ def create_scenario(&return_value)
230
+ scenario = @space.create_scenario(@double)
231
+ scenario.with_any_args.once.returns(&return_value)
232
+ scenario.should be_terminal
233
+ scenario
234
+ end
200
235
  end
201
236
  end
@@ -38,5 +38,13 @@ module Expectations
38
38
  10.times {@expectation.attempt!}
39
39
  end
40
40
  end
41
+
42
+ describe TimesCalledExpectation, "#terminal? with AnyTimesMatcher" do
43
+ it_should_behave_like "RR::Expectations::TimesCalledExpectation with AnyTimesMatcher"
44
+
45
+ it "returns false" do
46
+ @expectation.should_not be_terminal
47
+ end
48
+ end
41
49
  end
42
50
  end
@@ -61,5 +61,13 @@ module Expectations
61
61
  @expectation.attempt!
62
62
  end
63
63
  end
64
+
65
+ describe TimesCalledExpectation, "#terminal? with AtLeastMatcher" do
66
+ it_should_behave_like "RR::Expectations::TimesCalledExpectation with AtLeastMatcher"
67
+
68
+ it "returns false" do
69
+ @expectation.should_not be_terminal
70
+ end
71
+ end
64
72
  end
65
73
  end
@@ -65,5 +65,13 @@ module Expectations
65
65
  @expectation.attempt!
66
66
  end
67
67
  end
68
+
69
+ describe TimesCalledExpectation, "#terminal? with AtMostMatcher" do
70
+ it_should_behave_like "RR::Expectations::TimesCalledExpectation with AtMostMatcher"
71
+
72
+ it "returns true" do
73
+ @expectation.should be_terminal
74
+ end
75
+ end
68
76
  end
69
77
  end
@@ -97,6 +97,14 @@ module Expectations
97
97
  @expectation.attempt!
98
98
  end.should raise_error(Errors::TimesCalledError)
99
99
  end
100
- end
100
+ end
101
+
102
+ describe TimesCalledExpectation, "#terminal? with IntegerMatcher" do
103
+ it_should_behave_like "RR::Expectations::TimesCalledExpectation with IntegerMatcher"
104
+
105
+ it "returns true" do
106
+ @expectation.should be_terminal
107
+ end
108
+ end
101
109
  end
102
110
  end
@@ -76,5 +76,13 @@ module Expectations
76
76
  @object.foobar
77
77
  end
78
78
  end
79
+
80
+ describe TimesCalledExpectation, "#terminal? with ProcMatcher" do
81
+ it_should_behave_like "RR::Expectations::TimesCalledExpectation with ProcMatcher"
82
+
83
+ it "returns false" do
84
+ @expectation.should_not be_terminal
85
+ end
86
+ end
79
87
  end
80
88
  end
@@ -76,6 +76,14 @@ module Expectations
76
76
  @expectation.attempt!
77
77
  raises_expectation_error {@expectation.attempt!}
78
78
  end
79
- end
79
+ end
80
+
81
+ describe TimesCalledExpectation, "#terminal? with RangeMatcher" do
82
+ it_should_behave_like "RR::Expectations::TimesCalledExpectation with RangeMatcher"
83
+
84
+ it "returns true" do
85
+ @expectation.should be_terminal
86
+ end
87
+ end
80
88
  end
81
89
  end
@@ -214,7 +214,7 @@ describe Scenario, "#ordered" do
214
214
  end
215
215
 
216
216
  it "sets return value when block passed in" do
217
- @scenario.with_any_args.ordered {:return_value}
217
+ @scenario.with_any_args.once.ordered {:return_value}
218
218
  @object.foobar.should == :return_value
219
219
  end
220
220
  end
@@ -369,15 +369,14 @@ describe Scenario, "#call implemented by a proc" do
369
369
  scenario1 = @scenario
370
370
  scenario2 = @space.create_scenario(@double)
371
371
 
372
- scenario1.with(1).returns {:return_1}.ordered
373
- scenario2.with(2).returns {:return_2}.ordered
372
+ scenario1.with(1).returns {:return_1}.ordered.once
373
+ scenario2.with(2).returns {:return_2}.ordered.once
374
374
 
375
375
  proc do
376
376
  @object.foobar(2)
377
377
  end.should raise_error(
378
378
  Errors::ScenarioOrderError,
379
- "foobar(2)\n" <<
380
- "called out of order in list\n" <<
379
+ "foobar(2) called out of order in list\n" <<
381
380
  "- foobar(1)\n" <<
382
381
  "- foobar(2)"
383
382
  )
@@ -553,6 +552,27 @@ describe Scenario, "#verify" do
553
552
  end
554
553
  end
555
554
 
555
+ describe Scenario, "#terminal?" do
556
+ it_should_behave_like "RR::Scenario"
557
+
558
+ it "returns true when times_called_expectation's terminal? is true" do
559
+ @scenario.once
560
+ @scenario.times_called_expectation.should be_terminal
561
+ @scenario.should be_terminal
562
+ end
563
+
564
+ it "returns false when times_called_expectation's terminal? is false" do
565
+ @scenario.any_number_of_times
566
+ @scenario.times_called_expectation.should_not be_terminal
567
+ @scenario.should_not be_terminal
568
+ end
569
+
570
+ it "returns false when there is not times_called_expectation" do
571
+ @scenario.times_called_expectation.should be_nil
572
+ @scenario.should_not be_terminal
573
+ end
574
+ end
575
+
556
576
  describe Scenario, "#method_name" do
557
577
  it_should_behave_like "RR::Scenario"
558
578
 
@@ -575,4 +595,4 @@ describe Scenario, "#expected_arguments" do
575
595
  @scenario.expected_arguments.should == []
576
596
  end
577
597
  end
578
- end
598
+ end
@@ -99,6 +99,21 @@ describe Space, "#verify_ordered_scenario", :shared => true do
99
99
  @method_name = :foobar
100
100
  @double = @space.create_double(@object, @method_name)
101
101
  end
102
+
103
+ it "raises an error when Scenario is NonTerminal" do
104
+ scenario = @space.create_scenario(@double)
105
+ @space.register_ordered_scenario(scenario)
106
+
107
+ scenario.any_number_of_times
108
+ scenario.should_not be_terminal
109
+
110
+ proc do
111
+ @space.verify_ordered_scenario(scenario)
112
+ end.should raise_error(
113
+ Errors::ScenarioOrderError,
114
+ "Ordered Scenarios cannot have a NonTerminal TimesCalledExpectation"
115
+ )
116
+ end
102
117
  end
103
118
 
104
119
  describe Space, "#verify_ordered_scenario where the passed in scenario is at the front of the queue" do
@@ -132,20 +147,23 @@ describe Space, "#verify_ordered_scenario where the passed in scenario is not at
132
147
  it_should_behave_like "RR::Space#verify_ordered_scenario"
133
148
 
134
149
  it "raises error" do
135
- first_scenario = @space.create_scenario(@double)
136
- @space.register_ordered_scenario(first_scenario)
137
- second_scenario = @space.create_scenario(@double)
138
- @space.register_ordered_scenario(second_scenario)
150
+ first_scenario = create_scenario
151
+ second_scenario = create_scenario
139
152
 
140
153
  proc do
141
154
  @space.verify_ordered_scenario(second_scenario)
142
155
  end.should raise_error(
143
156
  Errors::ScenarioOrderError,
144
- "foobar()\n" <<
145
- "called out of order in list\n" <<
157
+ "foobar() called out of order in list\n" <<
146
158
  "- foobar()\n" <<
147
159
  "- foobar()"
148
160
  )
149
161
  end
162
+
163
+ def create_scenario
164
+ scenario = @space.create_scenario(@double).once
165
+ @space.register_ordered_scenario(scenario)
166
+ scenario
167
+ end
150
168
  end
151
169
  end
@@ -2,6 +2,12 @@ require "examples/example_helper"
2
2
 
3
3
  module RR
4
4
  module TimesCalledMatchers
5
+ describe AnyTimesMatcher, :shared => true do
6
+ before do
7
+ @matcher = AnyTimesMatcher.new
8
+ end
9
+ end
10
+
5
11
  describe TimesCalledMatcher, ".create when passed a AnyTimesMatcher" do
6
12
  it "returns the passed in argument" do
7
13
  matcher = AnyTimesMatcher.new
@@ -10,9 +16,7 @@ module TimesCalledMatchers
10
16
  end
11
17
 
12
18
  describe AnyTimesMatcher, "#possible_match?" do
13
- before do
14
- @matcher = AnyTimesMatcher.new
15
- end
19
+ it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"
16
20
 
17
21
  it "always returns true" do
18
22
  @matcher.should be_possible_match(0)
@@ -21,9 +25,7 @@ module TimesCalledMatchers
21
25
  end
22
26
 
23
27
  describe AnyTimesMatcher, "#matches?" do
24
- before do
25
- @matcher = AnyTimesMatcher.new
26
- end
28
+ it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"
27
29
 
28
30
  it "always returns true" do
29
31
  @matcher.should be_matches(0)
@@ -32,20 +34,24 @@ module TimesCalledMatchers
32
34
  end
33
35
 
34
36
  describe AnyTimesMatcher, "#attempt?" do
35
- before do
36
- @matcher = AnyTimesMatcher.new
37
- end
37
+ it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"
38
38
 
39
39
  it "always returns true" do
40
40
  @matcher.should be_attempt(0)
41
41
  @matcher.should be_attempt(99999)
42
42
  end
43
- end
43
+ end
44
44
 
45
- describe AnyTimesMatcher, "#error_message" do
46
- before do
47
- @matcher = AnyTimesMatcher.new
45
+ describe AnyTimesMatcher, "#terminal?" do
46
+ it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"
47
+
48
+ it "returns false" do
49
+ @matcher.should_not be_terminal
48
50
  end
51
+ end
52
+
53
+ describe AnyTimesMatcher, "#error_message" do
54
+ it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"
49
55
 
50
56
  it "has an error message" do
51
57
  @matcher.error_message(2).should == (
@@ -2,6 +2,13 @@ require "examples/example_helper"
2
2
 
3
3
  module RR
4
4
  module TimesCalledMatchers
5
+ describe AtLeastMatcher, :shared => true do
6
+ before do
7
+ @times = 3
8
+ @matcher = AtLeastMatcher.new(@times)
9
+ end
10
+ end
11
+
5
12
  describe TimesCalledMatcher, ".create when passed a AtLeastMatcher" do
6
13
  it "returns the passed in argument" do
7
14
  matcher = AtLeastMatcher.new(5)
@@ -10,10 +17,7 @@ module TimesCalledMatchers
10
17
  end
11
18
 
12
19
  describe AtLeastMatcher, "#possible_match?" do
13
- before do
14
- @times = 3
15
- @matcher = AtLeastMatcher.new(@times)
16
- end
20
+ it_should_behave_like "RR::TimesCalledMatchers::AtLeastMatcher"
17
21
 
18
22
  it "always returns true" do
19
23
  @matcher.should be_possible_match(99999)
@@ -21,10 +25,7 @@ module TimesCalledMatchers
21
25
  end
22
26
 
23
27
  describe AtLeastMatcher, "#matches?" do
24
- before do
25
- @times = 3
26
- @matcher = AtLeastMatcher.new(@times)
27
- end
28
+ it_should_behave_like "RR::TimesCalledMatchers::AtLeastMatcher"
28
29
 
29
30
  it "returns false when times_called less than times" do
30
31
  @matcher.should_not be_matches(2)
@@ -40,10 +41,7 @@ module TimesCalledMatchers
40
41
  end
41
42
 
42
43
  describe AtLeastMatcher, "#attempt?" do
43
- before do
44
- @times = 3
45
- @matcher = AtLeastMatcher.new(@times)
46
- end
44
+ it_should_behave_like "RR::TimesCalledMatchers::AtLeastMatcher"
47
45
 
48
46
  it "always returns true" do
49
47
  @matcher.should be_attempt(1)
@@ -51,11 +49,16 @@ module TimesCalledMatchers
51
49
  end
52
50
  end
53
51
 
54
- describe AtLeastMatcher, "#error_message" do
55
- before do
56
- @times = 3
57
- @matcher = AtLeastMatcher.new(@times)
52
+ describe AnyTimesMatcher, "#terminal?" do
53
+ it_should_behave_like "RR::TimesCalledMatchers::AtLeastMatcher"
54
+
55
+ it "returns false" do
56
+ @matcher.should_not be_terminal
58
57
  end
58
+ end
59
+
60
+ describe AtLeastMatcher, "#error_message" do
61
+ it_should_behave_like "RR::TimesCalledMatchers::AtLeastMatcher"
59
62
 
60
63
  it "has an error message" do
61
64
  @matcher.error_message(2).should == (
@@ -2,6 +2,13 @@ require "examples/example_helper"
2
2
 
3
3
  module RR
4
4
  module TimesCalledMatchers
5
+ describe AtMostMatcher, :shared => true do
6
+ before do
7
+ @times = 3
8
+ @matcher = AtMostMatcher.new(@times)
9
+ end
10
+ end
11
+
5
12
  describe TimesCalledMatcher, ".create when passed a AtMostMatcher" do
6
13
  it "returns the passed in argument" do
7
14
  matcher = AtMostMatcher.new(5)
@@ -10,10 +17,7 @@ module TimesCalledMatchers
10
17
  end
11
18
 
12
19
  describe AtMostMatcher, "#possible_match?" do
13
- before do
14
- @times = 3
15
- @matcher = AtMostMatcher.new(@times)
16
- end
20
+ it_should_behave_like "RR::TimesCalledMatchers::AtMostMatcher"
17
21
 
18
22
  it "returns true when times called < times" do
19
23
  @matcher.should be_possible_match(2)
@@ -29,10 +33,7 @@ module TimesCalledMatchers
29
33
  end
30
34
 
31
35
  describe AtMostMatcher, "#matches?" do
32
- before do
33
- @times = 3
34
- @matcher = AtMostMatcher.new(@times)
35
- end
36
+ it_should_behave_like "RR::TimesCalledMatchers::AtMostMatcher"
36
37
 
37
38
  it "returns true when times_called less than times" do
38
39
  @matcher.should be_matches(2)
@@ -48,10 +49,7 @@ module TimesCalledMatchers
48
49
  end
49
50
 
50
51
  describe AtMostMatcher, "#attempt?" do
51
- before do
52
- @times = 3
53
- @matcher = AtMostMatcher.new(@times)
54
- end
52
+ it_should_behave_like "RR::TimesCalledMatchers::AtMostMatcher"
55
53
 
56
54
  it "returns true when less than expected times" do
57
55
  @matcher.should be_attempt(2)
@@ -66,11 +64,16 @@ module TimesCalledMatchers
66
64
  end
67
65
  end
68
66
 
69
- describe AtMostMatcher, "#error_message" do
70
- before do
71
- @times = 3
72
- @matcher = AtMostMatcher.new(@times)
67
+ describe AnyTimesMatcher, "#terminal?" do
68
+ it_should_behave_like "RR::TimesCalledMatchers::AtMostMatcher"
69
+
70
+ it "returns true" do
71
+ @matcher.should be_terminal
73
72
  end
73
+ end
74
+
75
+ describe AtMostMatcher, "#error_message" do
76
+ it_should_behave_like "RR::TimesCalledMatchers::AtMostMatcher"
74
77
 
75
78
  it "has an error message" do
76
79
  @matcher.error_message(5).should == (
@@ -2,6 +2,13 @@ require "examples/example_helper"
2
2
 
3
3
  module RR
4
4
  module TimesCalledMatchers
5
+ describe IntegerMatcher, :shared => true do
6
+ before do
7
+ @times = 3
8
+ @matcher = IntegerMatcher.new(@times)
9
+ end
10
+ end
11
+
5
12
  describe TimesCalledMatcher, ".create when passed a IntegerMatcher" do
6
13
  it "returns the passed in argument" do
7
14
  matcher = IntegerMatcher.new(5)
@@ -16,10 +23,7 @@ module TimesCalledMatchers
16
23
  end
17
24
 
18
25
  describe IntegerMatcher, "#possible_match?" do
19
- before do
20
- @times = 3
21
- @matcher = IntegerMatcher.new(@times)
22
- end
26
+ it_should_behave_like "RR::TimesCalledMatchers::IntegerMatcher"
23
27
 
24
28
  it "returns true when times called < times" do
25
29
  @matcher.should be_possible_match(2)
@@ -35,10 +39,7 @@ module TimesCalledMatchers
35
39
  end
36
40
 
37
41
  describe IntegerMatcher, "#matches?" do
38
- before do
39
- @times = 3
40
- @matcher = IntegerMatcher.new(@times)
41
- end
42
+ it_should_behave_like "RR::TimesCalledMatchers::IntegerMatcher"
42
43
 
43
44
  it "returns false when times_called less than times" do
44
45
  @matcher.should_not be_matches(2)
@@ -54,10 +55,7 @@ module TimesCalledMatchers
54
55
  end
55
56
 
56
57
  describe IntegerMatcher, "#attempt?" do
57
- before do
58
- @times = 3
59
- @matcher = IntegerMatcher.new(@times)
60
- end
58
+ it_should_behave_like "RR::TimesCalledMatchers::IntegerMatcher"
61
59
 
62
60
  it "returns true when less than expected times" do
63
61
  @matcher.should be_attempt(2)
@@ -72,11 +70,16 @@ module TimesCalledMatchers
72
70
  end
73
71
  end
74
72
 
75
- describe IntegerMatcher, "#error_message" do
76
- before do
77
- @times = 3
78
- @matcher = IntegerMatcher.new(@times)
73
+ describe AnyTimesMatcher, "#terminal?" do
74
+ it_should_behave_like "RR::TimesCalledMatchers::IntegerMatcher"
75
+
76
+ it "returns true" do
77
+ @matcher.should be_terminal
79
78
  end
79
+ end
80
+
81
+ describe IntegerMatcher, "#error_message" do
82
+ it_should_behave_like "RR::TimesCalledMatchers::IntegerMatcher"
80
83
 
81
84
  it "has an error message" do
82
85
  @matcher.error_message(2).should == (
@@ -2,6 +2,13 @@ require "examples/example_helper"
2
2
 
3
3
  module RR
4
4
  module TimesCalledMatchers
5
+ describe ProcMatcher, :shared => true do
6
+ before do
7
+ @times = proc {|other| other == 3}
8
+ @matcher = ProcMatcher.new(@times)
9
+ end
10
+ end
11
+
5
12
  describe TimesCalledMatcher, ".create when passed a ProcMatcher" do
6
13
  it "returns the passed in argument" do
7
14
  matcher = ProcMatcher.new(proc {|other| other == 5})
@@ -17,10 +24,7 @@ module TimesCalledMatchers
17
24
  end
18
25
 
19
26
  describe ProcMatcher, "#possible_match?" do
20
- before do
21
- @times = proc {|other| other == 3}
22
- @matcher = ProcMatcher.new(@times)
23
- end
27
+ it_should_behave_like "RR::TimesCalledMatchers::ProcMatcher"
24
28
 
25
29
  it "always returns true" do
26
30
  @matcher.should be_possible_match(2)
@@ -30,10 +34,7 @@ module TimesCalledMatchers
30
34
  end
31
35
 
32
36
  describe ProcMatcher, "#matches?" do
33
- before do
34
- @times = proc {|other| other == 3}
35
- @matcher = ProcMatcher.new(@times)
36
- end
37
+ it_should_behave_like "RR::TimesCalledMatchers::ProcMatcher"
37
38
 
38
39
  it "returns false when proc returns false" do
39
40
  @times.call(2).should be_false
@@ -47,10 +48,7 @@ module TimesCalledMatchers
47
48
  end
48
49
 
49
50
  describe ProcMatcher, "#attempt?" do
50
- before do
51
- @times = proc {|other| other == 3}
52
- @matcher = ProcMatcher.new(@times)
53
- end
51
+ it_should_behave_like "RR::TimesCalledMatchers::ProcMatcher"
54
52
 
55
53
  it "always returns true" do
56
54
  @matcher.should be_attempt(2)
@@ -59,11 +57,16 @@ module TimesCalledMatchers
59
57
  end
60
58
  end
61
59
 
62
- describe ProcMatcher, "#error_message" do
63
- before do
64
- @times = proc {|other| other == 3}
65
- @matcher = ProcMatcher.new(@times)
60
+ describe ProcMatcher, "#terminal?" do
61
+ it_should_behave_like "RR::TimesCalledMatchers::ProcMatcher"
62
+
63
+ it "returns false" do
64
+ @matcher.should_not be_terminal
66
65
  end
66
+ end
67
+
68
+ describe ProcMatcher, "#error_message" do
69
+ it_should_behave_like "RR::TimesCalledMatchers::ProcMatcher"
67
70
 
68
71
  it "has an error message" do
69
72
  @matcher.error_message(1).should =~
@@ -2,6 +2,13 @@ require "examples/example_helper"
2
2
 
3
3
  module RR
4
4
  module TimesCalledMatchers
5
+ describe RangeMatcher, :shared => true do
6
+ before do
7
+ @times = 2..4
8
+ @matcher = RangeMatcher.new(@times)
9
+ end
10
+ end
11
+
5
12
  describe TimesCalledMatcher, ".create when passed a IntegerMatcher" do
6
13
  it "returns the passed in argument" do
7
14
  matcher = RangeMatcher.new(2..4)
@@ -16,10 +23,7 @@ module TimesCalledMatchers
16
23
  end
17
24
 
18
25
  describe RangeMatcher, "#possible_match?" do
19
- before do
20
- @times = 2..4
21
- @matcher = RangeMatcher.new(@times)
22
- end
26
+ it_should_behave_like "RR::TimesCalledMatchers::RangeMatcher"
23
27
 
24
28
  it "returns true when times called < start of range" do
25
29
  @matcher.should be_possible_match(1)
@@ -37,10 +41,7 @@ module TimesCalledMatchers
37
41
  end
38
42
 
39
43
  describe RangeMatcher, "#matches?" do
40
- before do
41
- @times = 2..4
42
- @matcher = RangeMatcher.new(@times)
43
- end
44
+ it_should_behave_like "RR::TimesCalledMatchers::RangeMatcher"
44
45
 
45
46
  it "returns false when times_called less than start of range" do
46
47
  @matcher.should_not be_matches(1)
@@ -58,10 +59,7 @@ module TimesCalledMatchers
58
59
  end
59
60
 
60
61
  describe RangeMatcher, "#attempt?" do
61
- before do
62
- @times = 2..4
63
- @matcher = RangeMatcher.new(@times)
64
- end
62
+ it_should_behave_like "RR::TimesCalledMatchers::RangeMatcher"
65
63
 
66
64
  it "returns true when less than start of range" do
67
65
  @matcher.should be_attempt(1)
@@ -78,11 +76,16 @@ module TimesCalledMatchers
78
76
  end
79
77
  end
80
78
 
81
- describe RangeMatcher, "#error_message" do
82
- before do
83
- @times = 2..4
84
- @matcher = RangeMatcher.new(@times)
79
+ describe RangeMatcher, "#terminal?" do
80
+ it_should_behave_like "RR::TimesCalledMatchers::RangeMatcher"
81
+
82
+ it "returns true" do
83
+ @matcher.should be_terminal
85
84
  end
85
+ end
86
+
87
+ describe RangeMatcher, "#error_message" do
88
+ it_should_behave_like "RR::TimesCalledMatchers::RangeMatcher"
86
89
 
87
90
  it "has an error message" do
88
91
  @matcher.error_message(1).should == (
data/lib/rr.rb CHANGED
@@ -1,5 +1,4 @@
1
- dir = File.dirname(__FILE__)
2
-
1
+ require "rr/space"
3
2
  require "rr/double"
4
3
 
5
4
  require "rr/creator"
@@ -9,7 +8,7 @@ require "rr/probe_creator"
9
8
  require "rr/do_not_allow_creator"
10
9
 
11
10
  require "rr/scenario"
12
- require "rr/space"
11
+ require "rr/scenario_matches"
13
12
 
14
13
  require "rr/errors/rr_error"
15
14
  require "rr/errors/scenario_not_found_error"
@@ -29,6 +28,8 @@ require "rr/wildcard_matchers/duck_type"
29
28
  require "rr/wildcard_matchers/regexp"
30
29
  require "rr/wildcard_matchers/range"
31
30
 
31
+ require "rr/times_called_matchers/terminal"
32
+ require "rr/times_called_matchers/non_terminal"
32
33
  require "rr/times_called_matchers/times_called_matcher"
33
34
  require "rr/times_called_matchers/any_times_matcher"
34
35
  require "rr/times_called_matchers/integer_matcher"
@@ -37,4 +38,4 @@ require "rr/times_called_matchers/proc_matcher"
37
38
  require "rr/times_called_matchers/at_least_matcher"
38
39
  require "rr/times_called_matchers/at_most_matcher"
39
40
 
40
- require "rr/extensions/double_methods"
41
+ require "rr/extensions/double_methods"
@@ -63,27 +63,42 @@ module RR
63
63
  end
64
64
 
65
65
  def call_method(args, block)
66
- matching_scenarios = []
67
- @scenarios.each do |scenario|
68
- if scenario.exact_match?(*args)
69
- matching_scenarios << scenario
70
- return scenario.call(*args, &block) if scenario.attempt?
71
- end
72
- end
73
- @scenarios.each do |scenario|
74
- if scenario.wildcard_match?(*args)
75
- matching_scenarios << scenario
76
- return scenario.call(*args, &block) if scenario.attempt?
77
- end
66
+ if scenario = find_scenario_to_attempt(args)
67
+ return scenario.call(*args, &block)
78
68
  end
79
- matching_scenarios.first.call(*args) unless matching_scenarios.empty?
80
69
  scenario_not_found_error(*args)
81
70
  end
82
71
 
83
72
  protected
73
+ def find_scenario_to_attempt(args)
74
+ matches = ScenarioMatches.new(@scenarios).find_all_matches!(args)
75
+
76
+ unless matches.exact_terminal_scenarios_to_attempt.empty?
77
+ return matches.exact_terminal_scenarios_to_attempt.first
78
+ end
79
+
80
+ unless matches.exact_non_terminal_scenarios_to_attempt.empty?
81
+ return matches.exact_non_terminal_scenarios_to_attempt.last
82
+ end
83
+
84
+ unless matches.wildcard_terminal_scenarios_to_attempt.empty?
85
+ return matches.wildcard_terminal_scenarios_to_attempt.first
86
+ end
87
+
88
+ unless matches.wildcard_non_terminal_scenarios_to_attempt.empty?
89
+ return matches.wildcard_non_terminal_scenarios_to_attempt.last
90
+ end
91
+
92
+ unless matches.matching_scenarios.empty?
93
+ # This will raise a TimesCalledError
94
+ return matches.matching_scenarios.first
95
+ end
96
+
97
+ return nil
98
+ end
99
+
84
100
  def scenario_not_found_error(*args)
85
- message = "No scenario for #{Scenario.formatted_name(@method_name, args)}\n"
86
- message << "in\n"
101
+ message = "No scenario for #{Scenario.formatted_name(@method_name, args)} in\n"
87
102
  message << Scenario.list_message_part(@scenarios)
88
103
  raise Errors::ScenarioNotFoundError, message
89
104
  end
@@ -38,6 +38,10 @@ module RR
38
38
  end
39
39
  end
40
40
 
41
+ def terminal?
42
+ @matcher.terminal?
43
+ end
44
+
41
45
  protected
42
46
  def verify_input_error
43
47
  raise Errors::TimesCalledError, error_message
@@ -297,6 +297,11 @@ module RR
297
297
  true
298
298
  end
299
299
 
300
+ def terminal?
301
+ return false unless @times_called_expectation
302
+ @times_called_expectation.terminal?
303
+ end
304
+
300
305
  # The method name that this Scenario is attatched to
301
306
  def method_name
302
307
  double.method_name
@@ -0,0 +1,51 @@
1
+ module RR
2
+ class ScenarioMatches
3
+ attr_reader :matching_scenarios,
4
+ :exact_terminal_scenarios_to_attempt,
5
+ :exact_non_terminal_scenarios_to_attempt,
6
+ :wildcard_terminal_scenarios_to_attempt,
7
+ :wildcard_non_terminal_scenarios_to_attempt
8
+ def initialize(scenarios)
9
+ @scenarios = scenarios
10
+ @matching_scenarios = []
11
+ @exact_terminal_scenarios_to_attempt = []
12
+ @exact_non_terminal_scenarios_to_attempt = []
13
+ @wildcard_terminal_scenarios_to_attempt = []
14
+ @wildcard_non_terminal_scenarios_to_attempt = []
15
+ end
16
+
17
+ def find_all_matches!(args)
18
+ @scenarios.each do |scenario|
19
+ if scenario.exact_match?(*args)
20
+ matching_scenarios << scenario
21
+ if scenario.attempt?
22
+ exact_scenario_is_terminal_or_non_terminal scenario
23
+ end
24
+ elsif scenario.wildcard_match?(*args)
25
+ matching_scenarios << scenario
26
+ if scenario.attempt?
27
+ wildcard_scenario_is_terminal_or_non_terminal scenario
28
+ end
29
+ end
30
+ end
31
+ self
32
+ end
33
+
34
+ protected
35
+ def exact_scenario_is_terminal_or_non_terminal(scenario)
36
+ if scenario.terminal?
37
+ exact_terminal_scenarios_to_attempt << scenario
38
+ else
39
+ exact_non_terminal_scenarios_to_attempt << scenario
40
+ end
41
+ end
42
+
43
+ def wildcard_scenario_is_terminal_or_non_terminal(scenario)
44
+ if scenario.terminal?
45
+ wildcard_terminal_scenarios_to_attempt << scenario
46
+ else
47
+ wildcard_non_terminal_scenarios_to_attempt << scenario
48
+ end
49
+ end
50
+ end
51
+ end
@@ -72,9 +72,13 @@ module RR
72
72
  # Verifies that the passed in ordered Scenario is being called
73
73
  # in the correct position.
74
74
  def verify_ordered_scenario(scenario)
75
+ unless scenario.terminal?
76
+ raise Errors::ScenarioOrderError,
77
+ "Ordered Scenarios cannot have a NonTerminal TimesCalledExpectation"
78
+ end
75
79
  unless @ordered_scenarios.first == scenario
76
80
  message = Scenario.formatted_name(scenario.method_name, scenario.expected_arguments)
77
- message << "\ncalled out of order in list\n"
81
+ message << " called out of order in list\n"
78
82
  message << Scenario.list_message_part(@ordered_scenarios)
79
83
  raise Errors::ScenarioOrderError, message
80
84
  end
@@ -1,21 +1,15 @@
1
1
  module RR
2
2
  module TimesCalledMatchers
3
3
  class AnyTimesMatcher < TimesCalledMatcher
4
+ include NonTerminal
5
+
4
6
  def initialize
5
7
  end
6
8
 
7
- def possible_match?(times_called)
8
- true
9
- end
10
-
11
9
  def matches?(times_called)
12
10
  true
13
11
  end
14
12
 
15
- def attempt?(times_called)
16
- true
17
- end
18
-
19
13
  protected
20
14
  def expected_message_part
21
15
  "Expected any number of times."
@@ -1,18 +1,12 @@
1
1
  module RR
2
2
  module TimesCalledMatchers
3
3
  class AtLeastMatcher < TimesCalledMatcher
4
- def possible_match?(times_called)
5
- true
6
- end
7
-
4
+ include NonTerminal
5
+
8
6
  def matches?(times_called)
9
7
  times_called >= @times
10
8
  end
11
9
 
12
- def attempt?(times_called)
13
- true
14
- end
15
-
16
10
  protected
17
11
  def expected_message_part
18
12
  "Expected at least #{@times.inspect} times."
@@ -1,6 +1,8 @@
1
1
  module RR
2
2
  module TimesCalledMatchers
3
3
  class AtMostMatcher < TimesCalledMatcher
4
+ include Terminal
5
+
4
6
  def possible_match?(times_called)
5
7
  times_called <= @times
6
8
  end
@@ -1,6 +1,8 @@
1
1
  module RR
2
2
  module TimesCalledMatchers
3
3
  class IntegerMatcher < TimesCalledMatcher
4
+ include Terminal
5
+
4
6
  def possible_match?(times_called)
5
7
  times_called <= @times
6
8
  end
@@ -0,0 +1,27 @@
1
+ module RR
2
+ module TimesCalledMatchers
3
+ # Including this module marks the TimesCalledMatcher as NonTerminal.
4
+ # Being NonTerminal means the Scenario will not "terminate" even when
5
+ # called infinite times.
6
+ #
7
+ # The Scenario that uses a NonTerminal TimesCalledMatcher will
8
+ # continue using the Scenario when passed the matching arguments.
9
+ # This is done by the attempt? always returning true.
10
+ #
11
+ # This is in opposition to Terminal TimesCalledMatchers, where
12
+ # attempt? will eventually return false.
13
+ module NonTerminal
14
+ def terminal?
15
+ false
16
+ end
17
+
18
+ def possible_match?(times_called)
19
+ true
20
+ end
21
+
22
+ def attempt?(times_called)
23
+ true
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,17 +1,11 @@
1
1
  module RR
2
2
  module TimesCalledMatchers
3
3
  class ProcMatcher < TimesCalledMatcher
4
- def possible_match?(times_called)
5
- return true
6
- end
7
-
4
+ include NonTerminal
5
+
8
6
  def matches?(times_called)
9
7
  @times.call(times_called)
10
8
  end
11
-
12
- def attempt?(times_called)
13
- possible_match?(times_called)
14
- end
15
9
  end
16
10
  end
17
11
  end
@@ -1,6 +1,8 @@
1
1
  module RR
2
2
  module TimesCalledMatchers
3
3
  class RangeMatcher < TimesCalledMatcher
4
+ include Terminal
5
+
4
6
  def possible_match?(times_called)
5
7
  return true if times_called < @times.begin
6
8
  return true if @times.include?(times_called)
@@ -0,0 +1,20 @@
1
+ module RR
2
+ module TimesCalledMatchers
3
+ # Including this module marks the TimesCalledMatcher as Terminal.
4
+ # Being Terminal the Scenario will "terminate" when times called is
5
+ # finite.
6
+ #
7
+ # The Scenario that uses a Terminal TimesCalledMatcher will
8
+ # eventually be passed over to the next Scenario when passed
9
+ # the matching arguments enough times. This is done by the attempt?
10
+ # method returning false when executed a finite number of times.
11
+ #
12
+ # This is in opposition to NonTerminal TimesCalledMatchers, where
13
+ # attempt? will always return true.
14
+ module Terminal
15
+ def terminal?
16
+ true
17
+ end
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.3
3
3
  specification_version: 1
4
4
  name: rr
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.13
7
- date: 2007-07-14 00:00:00 -07:00
6
+ version: 0.1.14
7
+ date: 2007-07-16 00:00:00 -07:00
8
8
  summary: RR (Double Ruby) is a double framework that features a rich selection of double techniques and a terse syntax. http://xunitpatterns.com/Test%20Double.html
9
9
  require_paths:
10
10
  - lib
@@ -35,6 +35,7 @@ files:
35
35
  - lib/rr.rb
36
36
  - lib/rr/scenario.rb
37
37
  - lib/rr/creator.rb
38
+ - lib/rr/scenario_matches.rb
38
39
  - lib/rr/stub_creator.rb
39
40
  - lib/rr/space.rb
40
41
  - lib/rr/double.rb
@@ -47,6 +48,8 @@ files:
47
48
  - lib/rr/times_called_matchers/at_least_matcher.rb
48
49
  - lib/rr/times_called_matchers/proc_matcher.rb
49
50
  - lib/rr/times_called_matchers/integer_matcher.rb
51
+ - lib/rr/times_called_matchers/non_terminal.rb
52
+ - lib/rr/times_called_matchers/terminal.rb
50
53
  - lib/rr/times_called_matchers/range_matcher.rb
51
54
  - lib/rr/expectations/argument_equality_expectation.rb
52
55
  - lib/rr/expectations/times_called_expectation.rb
@@ -72,23 +75,11 @@ files:
72
75
  - examples/example_helper.rb
73
76
  - examples/test_unit_example_suite.rb
74
77
  - examples/high_level_example.rb
75
- - examples/rr/space_verify_example.rb
76
78
  - examples/rr/probe_creator_example.rb
77
- - examples/rr/double_reset_example.rb
78
79
  - examples/rr/mock_creator_example.rb
79
80
  - examples/rr/stub_creator_example.rb
80
81
  - examples/rr/scenario_example.rb
81
- - examples/rr/space_reset_example.rb
82
- - examples/rr/double_bind_example.rb
83
- - examples/rr/double_register_scenario_example.rb
84
- - examples/rr/space_create_example.rb
85
82
  - examples/rr/do_not_allow_creator_example.rb
86
- - examples/rr/double_example.rb
87
- - examples/rr/space_helper.rb
88
- - examples/rr/space_example.rb
89
- - examples/rr/double_dispatching_example.rb
90
- - examples/rr/space_register_example.rb
91
- - examples/rr/double_verify_example.rb
92
83
  - examples/rr/rspec/rspec_backtrace_tweaking_example.rb
93
84
  - examples/rr/rspec/rspec_adapter_example.rb
94
85
  - examples/rr/rspec/rspec_usage_example.rb
@@ -99,6 +90,12 @@ files:
99
90
  - examples/rr/times_called_matchers/proc_matcher_example.rb
100
91
  - examples/rr/times_called_matchers/any_times_matcher_example.rb
101
92
  - examples/rr/times_called_matchers/integer_matcher_example.rb
93
+ - examples/rr/space/space_verify_example.rb
94
+ - examples/rr/space/space_reset_example.rb
95
+ - examples/rr/space/space_create_example.rb
96
+ - examples/rr/space/space_helper.rb
97
+ - examples/rr/space/space_example.rb
98
+ - examples/rr/space/space_register_example.rb
102
99
  - examples/rr/expectations/is_a_argument_equality_expectation_example.rb
103
100
  - examples/rr/expectations/any_argument_expectation_example.rb
104
101
  - examples/rr/expectations/regexp_argument_equality_expectation_example.rb
@@ -117,6 +114,12 @@ files:
117
114
  - examples/rr/expectations/times_called_expectation/times_called_expectation_at_most_example.rb
118
115
  - examples/rr/expectations/times_called_expectation/times_called_expectation_range_example.rb
119
116
  - examples/rr/errors/rr_error_example.rb
117
+ - examples/rr/double/double_reset_example.rb
118
+ - examples/rr/double/double_bind_example.rb
119
+ - examples/rr/double/double_register_scenario_example.rb
120
+ - examples/rr/double/double_example.rb
121
+ - examples/rr/double/double_dispatching_example.rb
122
+ - examples/rr/double/double_verify_example.rb
120
123
  - examples/rr/test_unit/test_unit_backtrace_test.rb
121
124
  - examples/rr/test_unit/test_helper.rb
122
125
  - examples/rr/test_unit/test_unit_integration_test.rb