rr 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +4 -0
- data/Rakefile +2 -2
- data/examples/rr/space/space_create_example.rb +20 -0
- data/lib/rr.rb +1 -0
- data/lib/rr/hash_with_object_id_key.rb +32 -0
- data/lib/rr/space.rb +3 -1
- metadata +85 -84
data/CHANGES
CHANGED
data/Rakefile
CHANGED
@@ -21,7 +21,7 @@ def run_suite
|
|
21
21
|
end
|
22
22
|
|
23
23
|
PKG_NAME = "rr"
|
24
|
-
PKG_VERSION = "0.2.
|
24
|
+
PKG_VERSION = "0.2.4"
|
25
25
|
PKG_FILES = FileList[
|
26
26
|
'[A-Z]*',
|
27
27
|
'*.rb',
|
@@ -57,4 +57,4 @@ end
|
|
57
57
|
Rake::GemPackageTask.new(spec) do |pkg|
|
58
58
|
pkg.need_zip = true
|
59
59
|
pkg.need_tar = true
|
60
|
-
end
|
60
|
+
end
|
@@ -151,6 +151,26 @@ describe Space, "#create_scenario" do
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
+
describe Space, "#create_double" do
|
155
|
+
it_should_behave_like "RR::Space"
|
156
|
+
|
157
|
+
before do
|
158
|
+
@space = Space.new
|
159
|
+
end
|
160
|
+
|
161
|
+
it "creates a new double when existing object == but not === with the same method name" do
|
162
|
+
object1 = []
|
163
|
+
object2 = []
|
164
|
+
(object1 === object2).should be_true
|
165
|
+
object1.__id__.should_not == object2.__id__
|
166
|
+
|
167
|
+
double1 = @space.create_double(object1, :foobar)
|
168
|
+
double2 = @space.create_double(object2, :foobar)
|
169
|
+
|
170
|
+
double1.should_not == double2
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
154
174
|
describe Space, "#create_double when double does not exist" do
|
155
175
|
it_should_behave_like "RR::Space"
|
156
176
|
|
data/lib/rr.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
module RR
|
2
|
+
class HashWithObjectIdKey < ::Hash
|
3
|
+
alias_method :get_with_object_id, :[]
|
4
|
+
def [](key)
|
5
|
+
super(key.__id__)
|
6
|
+
end
|
7
|
+
|
8
|
+
alias_method :set_with_object_id, :[]=
|
9
|
+
def []=(key, value)
|
10
|
+
super(key.__id__, value)
|
11
|
+
end
|
12
|
+
|
13
|
+
def each
|
14
|
+
super do |object_id, value|
|
15
|
+
yield ObjectSpace._id2ref(object_id), value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete(key)
|
20
|
+
super(key.__id__)
|
21
|
+
end
|
22
|
+
|
23
|
+
def keys
|
24
|
+
raw_keys = super
|
25
|
+
raw_keys.collect {|raw_key| ObjectSpace._id2ref(raw_key)}
|
26
|
+
end
|
27
|
+
|
28
|
+
def include?(key)
|
29
|
+
super(key.__id__)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/rr/space.rb
CHANGED
@@ -18,7 +18,9 @@ module RR
|
|
18
18
|
attr_reader :doubles, :ordered_scenarios
|
19
19
|
attr_accessor :trim_backtrace
|
20
20
|
def initialize
|
21
|
-
@doubles =
|
21
|
+
@doubles = HashWithObjectIdKey.new do |hash, subject_object|
|
22
|
+
hash.set_with_object_id(subject_object, HashWithObjectIdKey.new)
|
23
|
+
end
|
22
24
|
@ordered_scenarios = []
|
23
25
|
@trim_backtrace = false
|
24
26
|
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.3
|
3
3
|
specification_version: 1
|
4
4
|
name: rr
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2007-07-
|
6
|
+
version: 0.2.4
|
7
|
+
date: 2007-07-19 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
|
@@ -29,107 +29,108 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Brian Takita
|
31
31
|
files:
|
32
|
-
- README
|
33
32
|
- Rakefile
|
34
33
|
- CHANGES
|
35
|
-
-
|
36
|
-
- lib/rr
|
37
|
-
- lib/rr/
|
34
|
+
- README
|
35
|
+
- lib/rr.rb
|
36
|
+
- lib/rr/mock_probe_creator.rb
|
37
|
+
- lib/rr/scenario.rb
|
38
|
+
- lib/rr/hash_with_object_id_key.rb
|
39
|
+
- lib/rr/creator.rb
|
40
|
+
- lib/rr/stub_probe_creator.rb
|
41
|
+
- lib/rr/scenario_matches.rb
|
42
|
+
- lib/rr/stub_creator.rb
|
43
|
+
- lib/rr/space.rb
|
44
|
+
- lib/rr/double.rb
|
45
|
+
- lib/rr/do_not_allow_creator.rb
|
46
|
+
- lib/rr/mock_creator.rb
|
47
|
+
- lib/rr/times_called_matchers/any_times_matcher.rb
|
48
|
+
- lib/rr/times_called_matchers/at_most_matcher.rb
|
49
|
+
- lib/rr/times_called_matchers/times_called_matcher.rb
|
50
|
+
- lib/rr/times_called_matchers/at_least_matcher.rb
|
51
|
+
- lib/rr/times_called_matchers/proc_matcher.rb
|
52
|
+
- lib/rr/times_called_matchers/integer_matcher.rb
|
53
|
+
- lib/rr/times_called_matchers/non_terminal.rb
|
54
|
+
- lib/rr/times_called_matchers/terminal.rb
|
55
|
+
- lib/rr/times_called_matchers/range_matcher.rb
|
38
56
|
- lib/rr/expectations/argument_equality_expectation.rb
|
39
57
|
- lib/rr/expectations/times_called_expectation.rb
|
40
58
|
- lib/rr/expectations/any_argument_expectation.rb
|
41
|
-
- lib/rr/scenario.rb
|
42
|
-
- lib/rr/stub_creator.rb
|
43
|
-
- lib/rr/errors/times_called_error.rb
|
44
59
|
- lib/rr/errors/scenario_not_found_error.rb
|
45
|
-
- lib/rr/errors/scenario_order_error.rb
|
46
60
|
- lib/rr/errors/argument_equality_error.rb
|
61
|
+
- lib/rr/errors/scenario_order_error.rb
|
47
62
|
- lib/rr/errors/rr_error.rb
|
48
|
-
- lib/rr/
|
49
|
-
- lib/rr/
|
50
|
-
- lib/rr/
|
51
|
-
- lib/rr/space.rb
|
52
|
-
- lib/rr/creator.rb
|
63
|
+
- lib/rr/errors/times_called_error.rb
|
64
|
+
- lib/rr/adapters/test_unit.rb
|
65
|
+
- lib/rr/adapters/rspec.rb
|
53
66
|
- lib/rr/wildcard_matchers/boolean.rb
|
54
|
-
- lib/rr/wildcard_matchers/anything.rb
|
55
|
-
- lib/rr/wildcard_matchers/numeric.rb
|
56
67
|
- lib/rr/wildcard_matchers/duck_type.rb
|
68
|
+
- lib/rr/wildcard_matchers/range.rb
|
57
69
|
- lib/rr/wildcard_matchers/regexp.rb
|
70
|
+
- lib/rr/wildcard_matchers/numeric.rb
|
58
71
|
- lib/rr/wildcard_matchers/is_a.rb
|
59
|
-
- lib/rr/wildcard_matchers/
|
60
|
-
- lib/rr/
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
- examples/rr/
|
74
|
-
- examples/rr/
|
75
|
-
- examples/rr/
|
76
|
-
- examples/rr/
|
77
|
-
- examples/rr/
|
72
|
+
- lib/rr/wildcard_matchers/anything.rb
|
73
|
+
- lib/rr/extensions/instance_methods.rb
|
74
|
+
- examples/environment_fixture_setup.rb
|
75
|
+
- examples/rspec_example_suite.rb
|
76
|
+
- examples/example_suite.rb
|
77
|
+
- examples/example_helper.rb
|
78
|
+
- examples/test_unit_example_suite.rb
|
79
|
+
- examples/high_level_example.rb
|
80
|
+
- examples/rr/stub_probe_creator_example.rb
|
81
|
+
- examples/rr/mock_creator_example.rb
|
82
|
+
- examples/rr/stub_creator_example.rb
|
83
|
+
- examples/rr/scenario_example.rb
|
84
|
+
- examples/rr/do_not_allow_creator_example.rb
|
85
|
+
- examples/rr/mock_probe_creator_example.rb
|
86
|
+
- examples/rr/rspec/rspec_backtrace_tweaking_example.rb
|
87
|
+
- examples/rr/rspec/rspec_adapter_example.rb
|
88
|
+
- examples/rr/rspec/rspec_usage_example.rb
|
89
|
+
- examples/rr/times_called_matchers/at_most_matcher_example.rb
|
90
|
+
- examples/rr/times_called_matchers/at_least_matcher_example.rb
|
91
|
+
- examples/rr/times_called_matchers/times_called_matcher_example.rb
|
92
|
+
- examples/rr/times_called_matchers/range_matcher_example.rb
|
93
|
+
- examples/rr/times_called_matchers/proc_matcher_example.rb
|
94
|
+
- examples/rr/times_called_matchers/any_times_matcher_example.rb
|
95
|
+
- examples/rr/times_called_matchers/integer_matcher_example.rb
|
96
|
+
- examples/rr/space/space_verify_example.rb
|
97
|
+
- examples/rr/space/space_reset_example.rb
|
98
|
+
- examples/rr/space/space_create_example.rb
|
99
|
+
- examples/rr/space/space_helper.rb
|
100
|
+
- examples/rr/space/space_example.rb
|
101
|
+
- examples/rr/space/space_register_example.rb
|
102
|
+
- examples/rr/expectations/is_a_argument_equality_expectation_example.rb
|
103
|
+
- examples/rr/expectations/any_argument_expectation_example.rb
|
104
|
+
- examples/rr/expectations/regexp_argument_equality_expectation_example.rb
|
105
|
+
- examples/rr/expectations/boolean_argument_equality_expectation_example.rb
|
106
|
+
- examples/rr/expectations/duck_type_argument_equality_expectation_example.rb
|
107
|
+
- examples/rr/expectations/numeric_argument_equality_expectation_example.rb
|
108
|
+
- examples/rr/expectations/range_argument_equality_expectation_example.rb
|
78
109
|
- examples/rr/expectations/argument_equality_expectation_example.rb
|
79
110
|
- examples/rr/expectations/anything_argument_equality_expectation_example.rb
|
80
|
-
- examples/rr/expectations/times_called_expectation/times_called_expectation_at_least_example.rb
|
81
|
-
- examples/rr/expectations/times_called_expectation/times_called_expectation_range_example.rb
|
82
111
|
- examples/rr/expectations/times_called_expectation/times_called_expectation_integer_example.rb
|
83
|
-
- examples/rr/expectations/times_called_expectation/
|
84
|
-
- examples/rr/expectations/times_called_expectation/times_called_expectation_proc_example.rb
|
112
|
+
- examples/rr/expectations/times_called_expectation/times_called_expectation_any_times_example.rb
|
85
113
|
- examples/rr/expectations/times_called_expectation/times_called_expectation_helper.rb
|
114
|
+
- examples/rr/expectations/times_called_expectation/times_called_expectation_proc_example.rb
|
115
|
+
- examples/rr/expectations/times_called_expectation/times_called_expectation_example.rb
|
116
|
+
- examples/rr/expectations/times_called_expectation/times_called_expectation_at_least_example.rb
|
86
117
|
- examples/rr/expectations/times_called_expectation/times_called_expectation_at_most_example.rb
|
87
|
-
- examples/rr/expectations/times_called_expectation/
|
88
|
-
- examples/rr/
|
89
|
-
- examples/rr/
|
90
|
-
- examples/rr/expectations/numeric_argument_equality_expectation_example.rb
|
91
|
-
- examples/rr/expectations/boolean_argument_equality_expectation_example.rb
|
92
|
-
- examples/rr/expectations/duck_type_argument_equality_expectation_example.rb
|
93
|
-
- examples/rr/expectations/regexp_argument_equality_expectation_example.rb
|
94
|
-
- examples/rr/expectations/range_argument_equality_expectation_example.rb
|
95
|
-
- examples/rr/rspec/rspec_adapter_example.rb
|
96
|
-
- examples/rr/rspec/rspec_usage_example.rb
|
97
|
-
- examples/rr/rspec/rspec_backtrace_tweaking_example.rb
|
98
|
-
- examples/rr/test_unit/test_helper.rb
|
99
|
-
- examples/rr/test_unit/test_unit_integration_test.rb
|
100
|
-
- examples/rr/test_unit/test_unit_backtrace_test.rb
|
101
|
-
- examples/rr/scenario_example.rb
|
118
|
+
- examples/rr/expectations/times_called_expectation/times_called_expectation_range_example.rb
|
119
|
+
- examples/rr/errors/rr_error_example.rb
|
120
|
+
- examples/rr/double/double_reset_example.rb
|
102
121
|
- examples/rr/double/double_bind_example.rb
|
103
|
-
- examples/rr/double/
|
122
|
+
- examples/rr/double/double_register_scenario_example.rb
|
104
123
|
- examples/rr/double/double_example.rb
|
105
|
-
- examples/rr/double/
|
124
|
+
- examples/rr/double/double_dispatching_example.rb
|
106
125
|
- examples/rr/double/double_verify_example.rb
|
107
|
-
- examples/rr/
|
108
|
-
- examples/rr/
|
109
|
-
- examples/rr/
|
110
|
-
- examples/rr/
|
111
|
-
- examples/rr/
|
112
|
-
- examples/rr/
|
113
|
-
- examples/rr/
|
114
|
-
- examples/rr/
|
115
|
-
- examples/rr/times_called_matchers/proc_matcher_example.rb
|
116
|
-
- examples/rr/times_called_matchers/times_called_matcher_example.rb
|
117
|
-
- examples/rr/times_called_matchers/at_most_matcher_example.rb
|
118
|
-
- examples/rr/times_called_matchers/any_times_matcher_example.rb
|
119
|
-
- examples/rr/times_called_matchers/at_least_matcher_example.rb
|
120
|
-
- examples/rr/times_called_matchers/range_matcher_example.rb
|
121
|
-
- examples/rr/times_called_matchers/integer_matcher_example.rb
|
122
|
-
- examples/rr/stub_probe_creator_example.rb
|
123
|
-
- examples/rr/stub_creator_example.rb
|
124
|
-
- examples/rr/do_not_allow_creator_example.rb
|
125
|
-
- examples/rr/mock_probe_creator_example.rb
|
126
|
-
- examples/rr/errors/rr_error_example.rb
|
127
|
-
- examples/rspec_example_suite.rb
|
128
|
-
- examples/high_level_example.rb
|
129
|
-
- examples/test_unit_example_suite.rb
|
130
|
-
- examples/example_suite.rb
|
131
|
-
- examples/environment_fixture_setup.rb
|
132
|
-
- examples/example_helper.rb
|
126
|
+
- examples/rr/test_unit/test_unit_backtrace_test.rb
|
127
|
+
- examples/rr/test_unit/test_helper.rb
|
128
|
+
- examples/rr/test_unit/test_unit_integration_test.rb
|
129
|
+
- examples/rr/extensions/instance_methods_argument_matcher_example.rb
|
130
|
+
- examples/rr/extensions/instance_methods_times_matcher_example.rb
|
131
|
+
- examples/rr/extensions/instance_methods_creator_example.rb
|
132
|
+
- examples/rr/extensions/instance_methods_space_example.rb
|
133
|
+
- examples/rr/extensions/instance_methods_example_helper.rb
|
133
134
|
test_files: []
|
134
135
|
|
135
136
|
rdoc_options:
|