rr 1.0.4 → 1.0.5.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +15 -0
  2. data/CHANGES.md +376 -0
  3. data/Gemfile +7 -10
  4. data/README.md +822 -0
  5. data/Rakefile +24 -78
  6. data/VERSION +1 -0
  7. data/lib/rr.rb +3 -0
  8. data/lib/rr/adapters/minitest.rb +6 -0
  9. data/lib/rr/adapters/rr_methods.rb +6 -10
  10. data/lib/rr/adapters/rspec.rb +3 -0
  11. data/lib/rr/adapters/rspec2.rb +30 -0
  12. data/lib/rr/adapters/test_unit.rb +2 -0
  13. data/lib/rr/double.rb +3 -2
  14. data/lib/rr/double_definitions/child_double_definition_create.rb +3 -2
  15. data/lib/rr/double_definitions/double_definition.rb +15 -13
  16. data/lib/rr/double_definitions/double_definition_create.rb +9 -5
  17. data/lib/rr/double_definitions/double_injections/any_instance_of.rb +3 -2
  18. data/lib/rr/double_definitions/strategies/strategy.rb +5 -4
  19. data/lib/rr/double_definitions/strategies/strategy_methods.rb +6 -8
  20. data/lib/rr/double_definitions/strategies/verification/mock.rb +3 -3
  21. data/lib/rr/double_matches.rb +2 -1
  22. data/lib/rr/expectations/argument_equality_expectation.rb +2 -2
  23. data/lib/rr/expectations/times_called_expectation.rb +2 -2
  24. data/lib/rr/injections/double_injection.rb +12 -11
  25. data/lib/rr/injections/injection.rb +2 -2
  26. data/lib/rr/injections/method_missing_injection.rb +21 -7
  27. data/lib/rr/injections/singleton_method_added_injection.rb +3 -1
  28. data/lib/rr/method_dispatches/base_method_dispatch.rb +1 -1
  29. data/lib/rr/method_dispatches/method_dispatch.rb +2 -1
  30. data/lib/rr/method_dispatches/method_missing_dispatch.rb +2 -1
  31. data/lib/rr/proc_from_block.rb +8 -4
  32. data/lib/rr/space.rb +3 -2
  33. data/lib/rr/times_called_matchers/times_called_matcher.rb +2 -2
  34. data/lib/rr/version.rb +5 -0
  35. data/lib/rr/wildcard_matchers/boolean.rb +2 -2
  36. data/spec/runner.rb +41 -0
  37. metadata +45 -133
  38. data/.gitignore +0 -10
  39. data/.runrc +0 -3
  40. data/.rvmrc +0 -2
  41. data/CHANGES +0 -266
  42. data/Gemfile.lock +0 -31
  43. data/README.rdoc +0 -392
  44. data/benchmarks/rr_benchmark.rb +0 -32
  45. data/benchmarks/rspec_benchmark.rb +0 -14
  46. data/doc/0.6.0.release.markdown +0 -81
  47. data/doc/todo.txt +0 -0
  48. data/introducting_rr.txt +0 -206
  49. data/rr.gemspec +0 -37
  50. data/spec/api/any_instance_of/all_instances_of_spec.rb +0 -12
  51. data/spec/api/any_instance_of/any_instance_of_spec.rb +0 -47
  52. data/spec/api/any_instance_of/instance_of_spec.rb +0 -12
  53. data/spec/api/dont_allow/dont_allow_after_stub_spec.rb +0 -14
  54. data/spec/api/mock/mock_spec.rb +0 -193
  55. data/spec/api/proxy/proxy_spec.rb +0 -86
  56. data/spec/api/spy/spy_spec.rb +0 -49
  57. data/spec/api/strong/strong_spec.rb +0 -87
  58. data/spec/api/stub/stub_spec.rb +0 -152
  59. data/spec/core_spec_suite.rb +0 -19
  60. data/spec/environment_fixture_setup.rb +0 -8
  61. data/spec/minitest_spec_suite.rb +0 -21
  62. data/spec/proc_from_block_spec.rb +0 -14
  63. data/spec/rr/adapters/rr_methods_argument_matcher_spec.rb +0 -67
  64. data/spec/rr/adapters/rr_methods_creator_spec.rb +0 -137
  65. data/spec/rr/adapters/rr_methods_space_spec.rb +0 -98
  66. data/spec/rr/adapters/rr_methods_spec_helper.rb +0 -11
  67. data/spec/rr/adapters/rr_methods_times_matcher_spec.rb +0 -13
  68. data/spec/rr/double_definitions/child_double_definition_creator_spec.rb +0 -112
  69. data/spec/rr/double_definitions/double_definition_create_blank_slate_spec.rb +0 -91
  70. data/spec/rr/double_definitions/double_definition_create_spec.rb +0 -443
  71. data/spec/rr/double_injection/double_injection_spec.rb +0 -546
  72. data/spec/rr/double_injection/double_injection_verify_spec.rb +0 -29
  73. data/spec/rr/errors/rr_error_spec.rb +0 -67
  74. data/spec/rr/expectations/any_argument_expectation_spec.rb +0 -47
  75. data/spec/rr/expectations/anything_argument_equality_expectation_spec.rb +0 -14
  76. data/spec/rr/expectations/argument_equality_expectation_spec.rb +0 -135
  77. data/spec/rr/expectations/boolean_argument_equality_expectation_spec.rb +0 -34
  78. data/spec/rr/expectations/hash_including_argument_equality_expectation_spec.rb +0 -82
  79. data/spec/rr/expectations/hash_including_spec.rb +0 -17
  80. data/spec/rr/expectations/satisfy_argument_equality_expectation_spec.rb +0 -59
  81. data/spec/rr/expectations/satisfy_spec.rb +0 -14
  82. data/spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb +0 -22
  83. data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb +0 -37
  84. data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_most_spec.rb +0 -43
  85. data/spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +0 -15
  86. data/spec/rr/expectations/times_called_expectation/times_called_expectation_integer_spec.rb +0 -58
  87. data/spec/rr/expectations/times_called_expectation/times_called_expectation_proc_spec.rb +0 -35
  88. data/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb +0 -39
  89. data/spec/rr/minitest/minitest_integration_test.rb +0 -59
  90. data/spec/rr/minitest/test_helper.rb +0 -7
  91. data/spec/rr/rspec/invocation_matcher_spec.rb +0 -279
  92. data/spec/rr/rspec/rspec_adapter_spec.rb +0 -63
  93. data/spec/rr/rspec/rspec_backtrace_tweaking_spec.rb +0 -31
  94. data/spec/rr/rspec/rspec_backtrace_tweaking_spec_fixture.rb +0 -11
  95. data/spec/rr/rspec/rspec_usage_spec.rb +0 -86
  96. data/spec/rr/space/hash_with_object_id_key_spec.rb +0 -88
  97. data/spec/rr/space/space_spec.rb +0 -596
  98. data/spec/rr/test_unit/test_helper.rb +0 -7
  99. data/spec/rr/test_unit/test_unit_backtrace_test.rb +0 -36
  100. data/spec/rr/test_unit/test_unit_integration_test.rb +0 -59
  101. data/spec/rr/times_called_matchers/any_times_matcher_spec.rb +0 -47
  102. data/spec/rr/times_called_matchers/at_least_matcher_spec.rb +0 -55
  103. data/spec/rr/times_called_matchers/at_most_matcher_spec.rb +0 -70
  104. data/spec/rr/times_called_matchers/integer_matcher_spec.rb +0 -70
  105. data/spec/rr/times_called_matchers/proc_matcher_spec.rb +0 -55
  106. data/spec/rr/times_called_matchers/range_matcher_spec.rb +0 -76
  107. data/spec/rr/times_called_matchers/times_called_matcher_spec.rb +0 -118
  108. data/spec/rr/wildcard_matchers/anything_spec.rb +0 -24
  109. data/spec/rr/wildcard_matchers/boolean_spec.rb +0 -36
  110. data/spec/rr/wildcard_matchers/duck_type_spec.rb +0 -52
  111. data/spec/rr/wildcard_matchers/is_a_spec.rb +0 -32
  112. data/spec/rr/wildcard_matchers/numeric_spec.rb +0 -32
  113. data/spec/rr/wildcard_matchers/range_spec.rb +0 -35
  114. data/spec/rr/wildcard_matchers/regexp_spec.rb +0 -43
  115. data/spec/rr_spec.rb +0 -28
  116. data/spec/rspec_spec_suite.rb +0 -17
  117. data/spec/spec.opts +0 -10
  118. data/spec/spec_helper.rb +0 -41
  119. data/spec/spec_suite.rb +0 -54
  120. data/spec/spy_verification_spec.rb +0 -129
  121. data/spec/test_unit_spec_suite.rb +0 -21
data/Gemfile.lock DELETED
@@ -1,31 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- archive-tar-minitar (0.5.2)
5
- columnize (0.3.2)
6
- diff-lcs (1.1.2)
7
- fattr (2.2.0)
8
- linecache19 (0.5.12)
9
- ruby_core_source (>= 0.1.4)
10
- rspec (1.3.0)
11
- ruby-debug-base19 (0.11.25)
12
- columnize (>= 0.3.1)
13
- linecache19 (>= 0.5.11)
14
- ruby_core_source (>= 0.1.4)
15
- ruby-debug19 (0.11.6)
16
- columnize (>= 0.3.1)
17
- linecache19 (>= 0.5.11)
18
- ruby-debug-base19 (>= 0.11.19)
19
- ruby_core_source (0.1.5)
20
- archive-tar-minitar (>= 0.5.2)
21
- session (3.1.0)
22
- fattr
23
-
24
- PLATFORMS
25
- ruby
26
-
27
- DEPENDENCIES
28
- diff-lcs (= 1.1.2)
29
- rspec (= 1.3.0)
30
- ruby-debug19 (= 0.11.6)
31
- session (= 3.1.0)
data/README.rdoc DELETED
@@ -1,392 +0,0 @@
1
- = RR
2
-
3
- RR (Double Ruby) is a test double framework that features a rich
4
- selection of double techniques and a terse syntax.
5
-
6
- To get started, install RR from the command prompt:
7
-
8
- gem install rr
9
-
10
- == More Information
11
- === Mailing Lists
12
- * double-ruby-users@rubyforge.org
13
- * double-ruby-devel@rubyforge.org
14
-
15
- === Websites
16
- * http://rubyforge.org/projects/double-ruby
17
- * http://github.com/btakita/rr
18
-
19
- == What is a Test Double?
20
- A Test Double is a generalization of something that replaces a real
21
- object to make it easier to test another object. Its like a stunt
22
- double for tests. The following are test doubles:
23
- * Mocks
24
- * Stubs
25
- * Fakes
26
- * Spies
27
- * Proxies
28
- http://xunitpatterns.com/Test%20Double.html
29
-
30
- Currently RR implements mocks, stubs, proxies, and spies. Fakes usually require custom code, so it is beyond the scope of RR.
31
-
32
- == Using RR
33
- === test/unit
34
- class Test::Unit::TestCase
35
- include RR::Adapters::TestUnit
36
- end
37
-
38
- === rspec
39
- Spec::Runner.configure do |config|
40
- config.mock_with :rr
41
- # or if that doesn't work due to a version incompatibility
42
- # config.mock_with RR::Adapters::Rspec
43
- end
44
-
45
- == standalone
46
- extend RR::Adapters::RRMethods
47
- mock(object).method_name {:return_value}
48
-
49
- object.method_name # Returns :return_value
50
-
51
- RR.verify # Verifies the Double expectations are satisfied
52
-
53
- == Syntax between RR and other double/mock frameworks
54
- === Terse Syntax
55
- One of the goals of RR is to make doubles more scannable.
56
- This is accomplished by making the double declaration look as much as the actual method invocation as possible.
57
- Here is RR compared to other mock frameworks:
58
-
59
- flexmock(User).should_receive(:find).with('42').and_return(jane) # Flexmock
60
- User.should_receive(:find).with('42').and_return(jane) # Rspec
61
- User.expects(:find).with('42').returns {jane} # Mocha
62
- User.should_receive(:find).with('42') {jane} # Rspec using return value blocks
63
- mock(User).find('42') {jane} # RR
64
-
65
- === Double Injections (a.k.a Partial Mocking)
66
- RR utilizes a technique known as "double injection".
67
-
68
- my_object = MyClass.new
69
- mock(my_object).hello
70
-
71
- Compare this with doing a mock in mocha:
72
- my_mocked_object = mock()
73
- my_mocked_object.expects(:hello)
74
-
75
- == Pure Mock objects
76
- If you wish to use objects for the sole purpose of being a mock, you can
77
- do so by creating an empty object.
78
- mock(my_mock_object = Object.new).hello
79
-
80
- or by using mock!
81
- my_mock_object = mock!.hello.subject # Mocks the #hello method and retrieves that object via the #subject method
82
-
83
- === No should_receive or expects method
84
- RR uses method_missing to set your method expectation. This means you do not
85
- need to use a method such as should_receive or expects.
86
-
87
- mock(my_object).hello # The hello method on my_object is mocked
88
-
89
- Mocha:
90
- my_object.expects(:hello) # expects sets the hello method expectation
91
- Rspec mocks:
92
- my_object.should_receive(:hello) # should_receive sets the hello method expectation
93
-
94
- === with method call is not necessary
95
- Since RR uses method_missing, it also makes using the #with method unnecessary in most circumstances
96
- to set the argument expectations.
97
-
98
- mock(my_object).hello('bob', 'jane')
99
-
100
- Mocha:
101
- my_object.expects(:hello).with('bob', 'jane')
102
- Rspec mocks:
103
- my_object.should_receive(:hello).with('bob', 'jane')
104
-
105
- === using a block to set the return value
106
- RR supports using a block to set the return value. RR also has the #returns method.
107
- Both of the examples are equivalent.
108
-
109
- mock(my_object).hello('bob', 'jane') {'Hello Bob and Jane'}
110
- mock(my_object).hello('bob', 'jane').returns('Hello Bob and Jane')
111
-
112
- Mocha:
113
- my_object.expects(:hello).with('bob', 'jane').returns('Hello Bob and Jane')
114
- Rspec mocks:
115
- my_object.should_receive(:hello).with('bob', 'jane').and_return('Hello Bob and Jane')
116
- my_object.should_receive(:hello).with('bob', 'jane') {'Hello Bob and Jane'} #rspec also supports blocks for the return value
117
-
118
- == Using RR
119
- To create a double on an object, you can use the following methods:
120
- * mock or mock!
121
- * stub or stub!
122
- * dont_allow or dont_allow!
123
- * proxy or proxy!
124
- * instance_of or instance_of!
125
-
126
- These methods are composable. mock, stub, and dont_allow can be used by themselves and
127
- are mutually exclusive.
128
- proxy and instance_of must be chained with mock or stub. You can also chain
129
- proxy and instance_of together.
130
-
131
- The ! (bang) version of these methods causes the subject object of the Double to be instantiated.
132
-
133
- === mock
134
- mock replaces the method on the object with an expectation and implementation.
135
- The expectations are a mock will be called with certain arguments a certain
136
- number of times (the default is once). You can also set the return value
137
- of the method invocation.
138
-
139
- See http://xunitpatterns.com/Mock%20Object.html
140
-
141
- The following example sets an expectation that the view will receive a method
142
- call to #render with the arguments {:partial => "user_info"} once.
143
- When the method is called "Information" is returned.
144
- view = controller.template
145
- mock(view).render(:partial => "user_info") {"Information"}
146
-
147
- You can also allow any number of arguments to be passed into the mock by using:
148
- mock(view).render.with_any_args.twice do |*args|
149
- if args.first == {:partial => "user_info}
150
- "User Info"
151
- else
152
- "Stuff in the view #{args.inspect}"
153
- end
154
- end
155
-
156
- === stub
157
- stub replaces the method on the object with only an implementation. You
158
- can still use arguments to differentiate which stub gets invoked.
159
-
160
- See http://xunitpatterns.com/Test%20Stub.html
161
-
162
- The following example makes the User.find method return jane when passed
163
- '42' and returns bob when passed '99'. If another id is passed to User.find,
164
- an exception is raised.
165
- jane = User.new
166
- bob = User.new
167
- stub(User).find('42') {jane}
168
- stub(User).find('99') {bob}
169
- stub(User).find do |id|
170
- raise "Unexpected id #{id.inspect} passed to me"
171
- end
172
-
173
- === dont_allow - aliased with do_not_allow, dont_call, and do_not_call
174
- dont_allow sets an expectation on the Double that it will never be called.
175
- If the Double is called, then a TimesCalledError is raised.
176
- dont_allow(User).find('42')
177
- User.find('42') # raises a TimesCalledError
178
-
179
- === mock.proxy
180
- mock.proxy replaces the method on the object with an expectation, implementation, and
181
- also invokes the actual method. mock.proxy also intercepts the return value and
182
- passes it into the return value block.
183
-
184
- The following example makes sets an expectation that view.render({:partial => "right_navigation"})
185
- gets called once and return the actual content of the rendered partial template.
186
- A call to view.render({:partial => "user_info"}) will render the user_info
187
- partial template and send the content into the block and is represented by the html variable.
188
- An assertion is done on the html and "Different html" is returned.
189
- view = controller.template
190
- mock.proxy(view).render(:partial => "right_navigation")
191
- mock.proxy(view).render(:partial => "user_info") do |html|
192
- html.should include("John Doe")
193
- "Different html"
194
- end
195
-
196
- You can also use mock.proxy to set expectations on the returned value. In
197
- the following example, a call to User.find('5') does the normal ActiveRecord
198
- implementation and passes the actual value, represented by the variable bob,
199
- into the block. bob is then set with a mock.proxy for projects to return
200
- only the first 3 projects. bob is also mocked with valid? to return false.
201
- mock.proxy(User).find('5') do |bob|
202
- mock.proxy(bob).projects do |projects|
203
- projects[0..3]
204
- end
205
- mock(bob).valid? {false}
206
- bob
207
- end
208
-
209
- === stub.proxy
210
- Intercept the return value of a method call.
211
- The following example verifies render partial will be called and
212
- renders the partial.
213
-
214
- view = controller.template
215
- stub.proxy(view).render(:partial => "user_info") do |html|
216
- html.should include("Joe Smith")
217
- html
218
- end
219
-
220
- === any_instance_of
221
- Allows stubs to be added to all instances of a class. It works by binding to methods from the class itself, rather than the eigenclass.
222
- This allows all instances (excluding instances with the method redefined in the eigenclass) to get the change.
223
-
224
- Due to Ruby runtime limitations, mocks will not work as expected. It's not obviously feasible (without an ObjectSpace lookup) to support all of RR's methods (such as mocking).
225
- ObjectSpace is not readily supported in jRuby, since it causes general slowness in the interpreter.
226
- I'm of the opinion that test speed is more important than having mocks on all instances of a class.
227
- If there is another solution, I'd be willing to add it.
228
-
229
- any_instance_of(User) do |u|
230
- stub(u).valid? {false}
231
- end
232
- # or
233
- any_instance_of(User, :valid? => false)
234
- # or
235
- any_instance_of(User, :valid? => lambda {false})
236
-
237
- === new_instance_of
238
- Stubs the new method of the class and allows doubles to be bound to new instances.
239
-
240
- Mocks can be used, because new instances are deterministically bound.
241
-
242
- new_instance_of(User) do |u|
243
- mock(u).valid? {false}
244
- end
245
-
246
- # Deprecated syntax
247
- mock.instance_of(User).valid? {false}
248
-
249
- === Spies
250
-
251
- Adding a DoubleInjection to an Object + Method (done by stub, mock, or dont_allow) causes RR to record any method
252
- invocations to the Object + method. Assertions can then be made on the recorded method calls.
253
-
254
- ==== test/unit
255
-
256
- subject = Object.new
257
- stub(subject).foo
258
- subject.foo(1)
259
- assert_received(subject) {|subject| subject.foo(1)}
260
- assert_received(subject) {|subject| subject.bar} # This fails
261
-
262
- ==== rspec
263
-
264
- subject = Object.new
265
- stub(subject).foo
266
- subject.foo(1)
267
- subject.should have_received.foo(1)
268
- subject.should have_received.bar # this fails
269
-
270
- === Block Syntax
271
- The block syntax has two modes
272
- * A normal block mode with a DoubleDefinitionCreatorProxy argument
273
-
274
- script = MyScript.new
275
- mock(script) do |expect|
276
- expect.system("cd #{RAILS_ENV}") {true}
277
- expect.system("rake foo:bar") {true}
278
- expect.system("rake baz") {true}
279
- end
280
-
281
- * An instance_eval mode where the DoubleDefinitionCreatorProxy is instance_evaled
282
-
283
- script = MyScript.new
284
- mock(script) do
285
- system("cd #{RAILS_ENV}") {true}
286
- system("rake foo:bar") {true}
287
- system("rake baz") {true}
288
- end
289
-
290
- === Block Syntax with explicit DoubleDefinitionCreatorProxy argument
291
-
292
-
293
- === Double Graphs
294
- RR has a method-chaining api support for Double graphs. For example,
295
- lets say you want an object to receive a method call to #foo, and have
296
- the return value receive a method call to #bar.
297
-
298
- In RR, you would do:
299
- stub(object).foo.stub!.bar {:baz}
300
- object.foo.bar # :baz
301
- # or
302
- stub(object).foo {stub!.bar {:baz}}
303
- object.foo.bar # :baz
304
- # or
305
- bar = stub!.bar {:baz}
306
- stub(object).foo {bar}
307
- object.foo.bar # :baz
308
-
309
- === Argument Wildcard matchers
310
- ==== anything
311
- mock(object).foobar(1, anything)
312
- object.foobar(1, :my_symbol)
313
-
314
- ==== is_a
315
- mock(object).foobar(is_a(Time))
316
- object.foobar(Time.now)
317
-
318
- ==== numeric
319
- mock(object).foobar(numeric)
320
- object.foobar(99)
321
-
322
- ==== boolean
323
- mock(object).foobar(boolean)
324
- object.foobar(false)
325
-
326
- ==== duck_type
327
- mock(object).foobar(duck_type(:walk, :talk))
328
- arg = Object.new
329
- def arg.walk; 'waddle'; end
330
- def arg.talk; 'quack'; end
331
- object.foobar(arg)
332
-
333
- ==== Ranges
334
- mock(object).foobar(1..10)
335
- object.foobar(5)
336
-
337
- ==== Regexps
338
- mock(object).foobar(/on/)
339
- object.foobar("ruby on rails")
340
-
341
- ==== hash_including
342
- mock(object).foobar(hash_including(:red => "#FF0000", :blue => "#0000FF"))
343
- object.foobar({:red => "#FF0000", :blue => "#0000FF", :green => "#00FF00"})
344
-
345
- ==== satisfy
346
- mock(object).foobar(satisfy {|arg| arg.length == 2})
347
- object.foobar("xy")
348
-
349
- ==== Writing your own Argument Matchers
350
- Writing a custom argument wildcard matcher is not difficult. See
351
- RR::WildcardMatchers for details.
352
-
353
- === Invocation Amount Wildcard Matchers
354
- ==== any_times
355
- mock(object).method_name(anything).times(any_times) {return_value}
356
-
357
- == Special Thanks To
358
- With any development effort, there are countless people who have contributed to making it possible. We all are standing on the shoulders of giants.
359
- If you have directly contributed to RR and I missed you in this list, please let me know and I will add you. Thanks!
360
- * Andreas Haller for patches
361
- * Aslak Hellesoy for Developing Rspec
362
- * Bryan Helmkamp for patches
363
- * Caleb Spare for patches
364
- * Christopher Redinger for patches
365
- * Dan North for syntax ideas
366
- * Dave Astels for some BDD inspiration
367
- * Dave Myron for a bug report
368
- * David Chelimsky for encouragement to make the RR framework, for developing the Rspec mock framework, syntax ideas, and patches
369
- * Daniel Sudol for identifing performance issues with RR
370
- * Dmitry Ratnikov for patches
371
- * Eugene Pimenov for patches
372
- * Evan Phoenix for patches
373
- * Felix Morio for pairing with me
374
- * Gabriel Horner for patches
375
- * Gavin Miller for patches
376
- * Gerard Meszaros for his excellent book "xUnit Test Patterns"
377
- * James Mead for developing Mocha
378
- * Jeff Whitmire for documentation suggestions
379
- * Jim Weirich for developing Flexmock, the first Terse ruby mock framework in Ruby
380
- * Joe Ferris for patches
381
- * Matthew O'Connor for patches and pairing with me
382
- * Michael Niessner for patches and pairing with me
383
- * Mike Mangino (from Elevated Rails) for patches and pairing with me
384
- * Myron Marston for bug reports
385
- * Nick Kallen for documentation suggestions, bug reports, and patches
386
- * Nathan Sobo for various ideas and inspiration for cleaner and more expressive code
387
- * Parker Thompson for pairing with me
388
- * Phil Darnowsky for patches
389
- * Pivotal Labs for sponsoring RR development
390
- * Stephen Baker for Developing Rspec
391
- * Tatsuya Ono for patches
392
- * Tuomas Kareinen for a bug report
@@ -1,32 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- require File.expand_path("#{dir}/../lib/rr")
3
- require "benchmark"
4
-
5
- o = Object.new
6
-
7
- Benchmark.bm do |x|
8
- x.report do
9
- 1000.times do
10
- RR.mock(o).foobar.returns("baz")
11
- o.foobar
12
- RR.reset
13
- end
14
- end
15
- end
16
-
17
- #require "ruby-prof"
18
- #RubyProf.start
19
- #
20
- ##RR.mock(o).foobar.returns("baz")
21
- ##o.foobar
22
- #10.times do
23
- # RR.mock(o).foobar.returns("baz")
24
- # o.foobar
25
- # RR.reset
26
- #end
27
- #
28
- #result = RubyProf.stop
29
- #
30
- ## Print a flat profile to text
31
- #printer = RubyProf::FlatPrinter.new(result)
32
- #printer.print(STDOUT, 0)