flexmock 1.0.0.beta.1 → 1.0.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,18 @@
1
1
  = Changes for FlexMock
2
2
 
3
+ == Version 1.0.0
4
+
5
+ * Added spy support.
6
+ * Added base class mocking restrictions.
7
+ * Using singleton_methods to get list of singleton methods (rather
8
+ than methods(false))
9
+ * Correctly handling mocking methods that were meta-programmed with
10
+ method_missing.
11
+
12
+ == Version 0.9.0
13
+
14
+ * Ruby 1.9.3 compatibility changes.
15
+
3
16
  == Version 0.8.5
4
17
 
5
18
  * Fixed warning about a void context.
@@ -45,7 +58,7 @@
45
58
 
46
59
  * Updated install.rb to handle non-root destination directories via
47
60
  DESTDIR.
48
- * Fixed operator bug introduced in 0.7.0.
61
+ * Fixed operator bug introduced in 0.7.0.
49
62
 
50
63
  == Version 0.7.0
51
64
 
@@ -79,15 +92,15 @@
79
92
  where mock support methods in the domain object would cause
80
93
  problems.
81
94
 
82
- * Internally renamed PartialMock to PartialMockProxy.
83
-
95
+ * Internally renamed PartialMock to PartialMockProxy.
96
+
84
97
  == Version 0.6.2
85
98
 
86
99
  * flexmock() with a block now always returns the domain object.
87
100
  flexmock() without a block returns the mock object. Note that for
88
101
  normal mocks, the domain and mock objects are the same. For partial
89
102
  mocks, the mock is separate from the domain object.
90
- * Added +and_raise+ to the list of expection specifications.
103
+ * Added +and_raise+ to the list of expection specifications.
91
104
 
92
105
  == Version 0.6.1
93
106
 
@@ -105,7 +118,7 @@
105
118
 
106
119
  == Version 0.5.1
107
120
 
108
- * Changed the name of any_instance to new_instances.
121
+ * Changed the name of any_instance to new_instances.
109
122
  Deprecated any_instance.
110
123
  * Added ability to stub any class method in new_instances.
111
124
  * Added RCov task
@@ -128,12 +141,12 @@
128
141
  == Version 0.4.3
129
142
 
130
143
  * Fixed bug where non-direct class methods were not properly handled.
131
-
144
+
132
145
  == Version 0.4.2
133
146
 
134
147
  * Fixed bug where multiple stubs of a class method were not
135
148
  properly restored.
136
-
149
+
137
150
  == Version 0.4.1
138
151
 
139
152
  * Removed include of Test::Unit::Assertions from Expectations.
@@ -167,8 +180,8 @@
167
180
  * Added strict mode in record mode interface to facility using known
168
181
  good algorithms for comparison testing.
169
182
  * Improved the docs and examples. Fixed garbled first example in
170
- README.
171
-
183
+ README.
184
+
172
185
  == Version 0.2.0
173
186
 
174
187
  * Added record mode for building expectations.
data/README.rdoc CHANGED
@@ -3,15 +3,14 @@
3
3
  FlexMock is a simple, but flexible, mock object library for Ruby unit
4
4
  testing.
5
5
 
6
- Version :: 1.0.0.beta.1
6
+ Version :: 1.0.0.beta.2
7
7
 
8
8
  = Links
9
9
 
10
- <b>Documents</b> :: http://flexmock.rubyforge.org
11
- <b>RubyGems</b> :: Install with: <b>gem install flexmock</b>
12
- <b>Download</b> :: Download from RubyForge at http://rubyforge.org/frs/?group_id=3433 (pre 0.6.0 versions may be found at http://rubyforge.org/frs/?group_id=170)
13
- <b>Issue Tracking</b> :: http://www.pivotaltracker.com/projects/28401
14
- <b>Bug Reports</b> :: http://onestepback.org/cgi-bin/bugs.cgi?project=flexmock
10
+ <b>Documents</b> :: http://flexmock.rubyforge.org
11
+ <b>RubyGems</b> :: Install with: <b>gem install flexmock</b>
12
+ <b>Source</b> :: https://github.com/jimweirich/flexmock
13
+ <b>Bug Reports and Issue Tracking</b> :: https://github.com/jimweirich/flexmock/issues
15
14
 
16
15
  == Installation
17
16
 
@@ -78,11 +77,11 @@ Your test case will look something like this:
78
77
  end
79
78
  end
80
79
 
81
- <b>NOTE:</b> If you don't want to automatically extend every TestCase with the
82
- flexmock methods and overhead, then require the 'flexmock' file and explicitly
83
- include the FlexMock::TestCase module in each test case class where you wish
84
- to use mock objects. FlexMock versions prior to 0.6.0 required the explicit
85
- include.
80
+ <b>NOTE:</b> If you don't want to automatically extend every TestCase
81
+ with the flexmock methods and overhead, then require the 'flexmock'
82
+ file and explicitly include the FlexMock::TestCase module in each test
83
+ case class where you wish to use mock objects. FlexMock versions prior
84
+ to 0.6.0 required the explicit include.
86
85
 
87
86
  == RSpec Integration
88
87
 
@@ -124,14 +123,15 @@ FlexMock::MockContainer#flexmock for more details.
124
123
 
125
124
  * <b>mock = flexmock(:foo => :bar, :baz => :froz)</b>
126
125
 
127
- Create a mock object and define two mocked methods (:foo and :baz) that
128
- return the values :bar and :froz respectively. This is useful when creating
129
- mock objects with just a few methods and simple return values.
126
+ Create a mock object and define two mocked methods (:foo and :baz)
127
+ that return the values :bar and :froz respectively. This is useful
128
+ when creating mock objects with just a few methods and simple return
129
+ values.
130
130
 
131
131
  * <b>mock = flexmock("joe", :foo => :bar, :bar => :froz)</b>
132
132
 
133
- You can combine the mock name and an expectation hash in the same call to
134
- flexmock.
133
+ You can combine the mock name and an expectation hash in the same
134
+ call to flexmock.
135
135
 
136
136
  * <b>mock = flexmock("joe", :on, User)</b>
137
137
 
@@ -148,8 +148,8 @@ FlexMock::MockContainer#flexmock for more details.
148
148
 
149
149
  If you you give <code>flexmock</code> a real object in the argument
150
150
  list, it will treat that real object as a base for a partial mock
151
- object. The return value <code>m</code> may be used to set
152
- expectations. The real_object should be used in the reference
151
+ object. The return value <code>partial_mock</code> may be used to
152
+ set expectations. The real_object should be used in the reference
153
153
  portion of the test.
154
154
 
155
155
  * <b>partial_mock = flexmock(real_object, "name", :foo => :baz)</b>
@@ -159,22 +159,23 @@ FlexMock::MockContainer#flexmock for more details.
159
159
  * <b>partial_mock = flexmock(:base, real_string_object)</b>
160
160
 
161
161
  Since Strings (and Symbols for that matter) are used for mock names,
162
- FlexMock will not recognize them as the base for a partial mock. To force a
163
- string to be used as a partial mock base, proceed the string object in the
164
- calling sequence with :base.
162
+ FlexMock will not recognize them as the base for a partial mock. To
163
+ force a string to be used as a partial mock base, proceed the string
164
+ object in the calling sequence with :base.
165
165
 
166
166
  * <b>partial_mock = flexmock(:safe, real_object) { |mock| mock.should_receive(...) }</b>
167
167
 
168
168
  When mocking real objects (i.e. "partial mocks"), FlexMock will add
169
169
  a handful of mock related methods to the actual object (see below
170
- for list of method names). If one or more of these added methods
171
- collide with an existing method on the partial mock, then there are problems.
170
+ for list of method names). If one or more of these added methods
171
+ collide with an existing method on the partial mock, then there are
172
+ problems.
172
173
 
173
174
  FlexMock offers a "safe" mode for partial mocks that does not add
174
- these methods. Indicate safe mode by passing the symbol :safe as
175
- the first argument of flexmock. A block <em>is required</em> when
176
- using safe mode (the partial_mock returned in safe mode does not
177
- have a <code>should_receive</code> method).
175
+ these methods. Indicate safe mode by passing the symbol :safe as the
176
+ first argument of flexmock. A block <em>is required</em> when using
177
+ safe mode (the partial_mock returned in safe mode does not have a
178
+ <code>should_receive</code> method).
178
179
 
179
180
  The methods added to partial mocks in non-safe mode are:
180
181
 
@@ -222,13 +223,14 @@ still available for backward compatibility.
222
223
 
223
224
  === Expectation Declarators
224
225
 
225
- Once a mock is created, you need to define what that mock should expect to
226
- see. Expectation declarators are used to specify these expectations placed
227
- upon received method calls. A basic expectation, created with the
228
- <code>should_receive</code> method, just establishes the fact that a method may (or may
229
- not) be called on the mock object. Refinements to that expectation may be
230
- additionally declared. FlexMock always starts with the most general
231
- expectation and adds constraints to that.
226
+ Once a mock is created, you need to define what that mock should
227
+ expect to see. Expectation declarators are used to specify these
228
+ expectations placed upon received method calls. A basic expectation,
229
+ created with the <code>should_receive</code> method, just establishes
230
+ the fact that a method may (or may not) be called on the mock object.
231
+ Refinements to that expectation may be additionally declared. FlexMock
232
+ always starts with the most general expectation and adds constraints
233
+ to that.
232
234
 
233
235
  For example, the following code:
234
236
 
@@ -241,8 +243,8 @@ speaking, the <code>and_return</code> part of the declaration isn't
241
243
  exactly a constraint, but it does specify what value the mock will
242
244
  return when the expectation is matched.
243
245
 
244
- If you want to be more specific, you need to add additional constraints to
245
- your expectation. Here are some examples:
246
+ If you want to be more specific, you need to add additional
247
+ constraints to your expectation. Here are some examples:
246
248
 
247
249
  mock.should_receive(:average).with(12).once
248
250
 
@@ -250,14 +252,15 @@ your expectation. Here are some examples:
250
252
  at_least.twice.at_most.times(10).
251
253
  and_return { rand }
252
254
 
253
- The following methods may be used to create and refine expectations on a mock
254
- object. See theFlexMock::Expectation for more details.
255
+ The following methods may be used to create and refine expectations on
256
+ a mock object. See theFlexMock::Expectation for more details.
255
257
 
256
258
  * <b>should_receive(<em>method_name</em>)</b>
257
259
 
258
- Declares that a message named <em>method_name</em> will be sent to the mock
259
- object. Constraints on this expected message (called expectations) may be
260
- chained to the <code>should_receive</code> call.
260
+ Declares that a message named <em>method_name</em> will be sent to
261
+ the mock object. Constraints on this expected message (called
262
+ expectations) may be chained to the <code>should_receive</code>
263
+ call.
261
264
 
262
265
  * <b>should_receive(<em>method_name1</em>, <em>method_name2</em>, ...)</b>
263
266
 
@@ -280,9 +283,10 @@ object. See theFlexMock::Expectation for more details.
280
283
 
281
284
  * <b>should_expect { |<em>recorder</em>| ... }</b>
282
285
 
283
- Creates a mock recording object that will translate received method calls
284
- into mock expectations. The recorder is passed to a block supplied with the
285
- <code>should_expect</code> method. See examples below.
286
+ Creates a mock recording object that will translate received method
287
+ calls into mock expectations. The recorder is passed to a block
288
+ supplied with the <code>should_expect</code> method. See examples
289
+ below.
286
290
 
287
291
  * <b>with(<em>arglist</em>)</b>
288
292
 
@@ -310,8 +314,8 @@ object. See theFlexMock::Expectation for more details.
310
314
 
311
315
  * <b>once</b>
312
316
 
313
- Declares that the expected message is only sent once. <tt>at_least</tt> /
314
- <tt>at_most</tt> modifiers are allowed.
317
+ Declares that the expected message is only sent once.
318
+ <tt>at_least</tt> / <tt>at_most</tt> modifiers are allowed.
315
319
 
316
320
  * <b>twice</b>
317
321
 
@@ -330,25 +334,25 @@ object. See theFlexMock::Expectation for more details.
330
334
 
331
335
  * <b>at_least</b>
332
336
 
333
- Modifies the immediately following message count constraint so that it means
334
- the message is sent at least that number of times. E.g.
335
- <tt>at_least.once</tt> means the message is sent at least once during the
336
- test, but may be sent more often. Both <tt>at_least</tt> and
337
- <tt>at_most</tt> may be specified on the same expectation.
337
+ Modifies the immediately following message count constraint so that
338
+ it means the message is sent at least that number of times. E.g.
339
+ <tt>at_least.once</tt> means the message is sent at least once
340
+ during the test, but may be sent more often. Both <tt>at_least</tt>
341
+ and <tt>at_most</tt> may be specified on the same expectation.
338
342
 
339
343
  * <b>at_most</b>
340
344
 
341
- Similar to <tt>at_least</tt>, but puts an upper limit on the number of
342
- messages. Both <tt>at_least</tt> and <tt>at_most</tt> may be specified on
343
- the same expectation.
345
+ Similar to <tt>at_least</tt>, but puts an upper limit on the number
346
+ of messages. Both <tt>at_least</tt> and <tt>at_most</tt> may be
347
+ specified on the same expectation.
344
348
 
345
349
  * <b>ordered</b>
346
350
 
347
- Declares that the expected message is ordered and is expected to be received
348
- in a certain position in a sequence of messages. The message should arrive
349
- after and previously declared ordered messages and prior to any following
350
- declared ordered messages. Unordered messages are ignored when considering
351
- the message order.
351
+ Declares that the expected message is ordered and is expected to be
352
+ received in a certain position in a sequence of messages. The
353
+ message should arrive after and previously declared ordered messages
354
+ and prior to any following declared ordered messages. Unordered
355
+ messages are ignored when considering the message order.
352
356
 
353
357
  Normally ordering is performed only against calls in the same mock
354
358
  object. If the "globally" adjective is used, then ordering is
@@ -356,9 +360,10 @@ object. See theFlexMock::Expectation for more details.
356
360
 
357
361
  * <b>ordered(<em>group</em>)</b>
358
362
 
359
- Declare that the expected message belongs to an order group. Methods within
360
- an order group may be received in any order. Ordered messages outside the
361
- group must be received either before or after all of the grouped messages.
363
+ Declare that the expected message belongs to an order group. Methods
364
+ within an order group may be received in any order. Ordered messages
365
+ outside the group must be received either before or after all of the
366
+ grouped messages.
362
367
 
363
368
  For example, in the following, messages <code>flip</code> and
364
369
  <code>flop</code> may be received in any order (because they are in
@@ -410,17 +415,17 @@ not.
410
415
 
411
416
  * <b>and_return(<em>value1</em>, <em>value2</em>, ...)</b>
412
417
 
413
- Declares that the expected message will return a series of values. Each
414
- invocation of the message will return the next value in the series. The last
415
- value will be repeatably returned if the number of matching calls exceeds
416
- the number of values.
418
+ Declares that the expected message will return a series of values.
419
+ Each invocation of the message will return the next value in the
420
+ series. The last value will be repeatably returned if the number of
421
+ matching calls exceeds the number of values.
417
422
 
418
423
  * <b>and_return { |<em>args</em>, ...| <em>code</em> ... } </b>
419
424
 
420
- Declares that the expected message will return the yielded value of the
421
- block. The block will receive all the arguments in the message. If the
422
- message was provided a block, it will be passed as the last parameter of the
423
- block's argument list.
425
+ Declares that the expected message will return the yielded value of
426
+ the block. The block will receive all the arguments in the message.
427
+ If the message was provided a block, it will be passed as the last
428
+ parameter of the block's argument list.
424
429
 
425
430
  * <b>returns( ... )</b>
426
431
 
@@ -519,10 +524,11 @@ The following rules are used for argument matching:
519
524
  with(3) will match f(3)
520
525
  with("hello") will match f("hello")
521
526
 
522
- * If you wish to override the default matching behavior and force matching by
523
- equality, you can use the FlexMock.eq convenience method. This is mostly
524
- used when you wish to match class objects, since the default matching
525
- behavior for class objects is to match instances, not themselves.
527
+ * If you wish to override the default matching behavior and force
528
+ matching by equality, you can use the FlexMock.eq convenience
529
+ method. This is mostly used when you wish to match class objects,
530
+ since the default matching behavior for class objects is to match
531
+ instances, not themselves.
526
532
 
527
533
  Examples:
528
534
 
@@ -595,9 +601,9 @@ object. If you pass a real object to the <code>flexmock</code> method,
595
601
  it will allow you to use that real object in your test and will just
596
602
  mock out the one or two methods that you specify.
597
603
 
598
- For example, suppose that a Dog object uses a Woofer object to bark. The code
599
- for Dog looks like this (we will leave the code for Woofer to your
600
- imagination):
604
+ For example, suppose that a Dog object uses a Woofer object to bark.
605
+ The code for Dog looks like this (we will leave the code for Woofer to
606
+ your imagination):
601
607
 
602
608
  class Dog
603
609
  def initialize
@@ -611,9 +617,9 @@ imagination):
611
617
  end
612
618
  end
613
619
 
614
- Now we want to test Dog, but using a real Woofer object in the test is a real
615
- pain (why? ... well because Woofer plays a sound file of a dog barking, and
616
- that's really annoying during testing).
620
+ Now we want to test Dog, but using a real Woofer object in the test is
621
+ a real pain (why? ... well because Woofer plays a sound file of a dog
622
+ barking, and that's really annoying during testing).
617
623
 
618
624
  So, how can we create a Dog object with mocked Woofer? All we need to
619
625
  do is allow FlexMock to replace the <code>bark</code> method.
@@ -636,9 +642,9 @@ Here's the test code:
636
642
  end
637
643
  end
638
644
 
639
- The nice thing about this technique is that after the test is over, the mocked
640
- out methods are returned to their normal state. Outside the test everything is
641
- back to normal.
645
+ The nice thing about this technique is that after the test is over,
646
+ the mocked out methods are returned to their normal state. Outside the
647
+ test everything is back to normal.
642
648
 
643
649
  <b>NOTE:</b> In previous versions of FlexMock, partial mocking was
644
650
  called "stubs" and the <code>flexstub</code> method was used to create
@@ -682,8 +688,8 @@ MiniTest for asserting that mocked methods are actually called.
682
688
  section above are allowed in the <code>assert_spy_called</code>
683
689
  method.
684
690
 
685
- The options has is optional. If omitted, all options have their
686
- default values.
691
+ The <code>options</code> hash is optional. If omitted, all options
692
+ will have their default values.
687
693
 
688
694
  * <b>assert_spy_not_called <em>mock</em>, <em>options_hash</em>, <em>method_name</em>, <em>args...</em></b>
689
695
 
data/Rakefile CHANGED
@@ -78,16 +78,17 @@ end
78
78
 
79
79
  # RDoc Target --------------------------------------------------------
80
80
 
81
- task :rdoc => ["html/index.html", :fixcss]
81
+ task :rdoc => ["README.rdoc", "html/index.html", :fixcss]
82
82
 
83
83
  file "html/index.html" => ["Rakefile"] + RDOC_FILES do
84
84
  sh "rdoc -o html --title FlexMock --line-numbers -m README.rdoc #{RDOC_FILES}"
85
85
  end
86
86
 
87
87
  file "README.rdoc" => ["Rakefile", "lib/flexmock/version.rb"] do
88
- ruby %{-i.bak -pe '$_.sub!(/^Version *:: *(\\d+\\.)+\\d+ *$/, "Version :: #{PKG_VERSION}")' README.rdoc} # "
88
+ ruby %{-i.bak -pe '$_.sub!(/^Version *:: *((\\d+|beta|rc)\\.)+\\d+ *$/i, "Version :: #{PKG_VERSION}")' README.rdoc} # "
89
89
  end
90
90
 
91
+ desc "Fix the Darkfish CSS so that paragraphs in lists have a bit of spacing"
91
92
  task :fixcss do
92
93
  open("html/rdoc.css") do |ins|
93
94
  open("html/rdoc.new", "w") do |outs|
@@ -6,6 +6,8 @@ a few bug fixes.
6
6
 
7
7
  == Changes in 1.0.0
8
8
 
9
+ === Features
10
+
9
11
  * Mocks may now have a base class that limits what methods may be
10
12
  mocked. This allows early detection of outdated mock setups when the
11
13
  methods in the class are refactored.
@@ -21,6 +23,12 @@ a few bug fixes.
21
23
  * An RSpec matcher (have_received) has been added to make spy
22
24
  assertions easy when using RSpec.
23
25
 
26
+ === Bug Fixes
27
+
28
+ * Now correctly handling the mocking of meta-programmed methods.
29
+
30
+ * Using the documented +singleton_methods+ method.
31
+
24
32
  == What is FlexMock?
25
33
 
26
34
  FlexMock is a flexible framework for creating mock object for testing. When
@@ -207,7 +207,7 @@ class FlexMock
207
207
  # Is the given method name a singleton method in the object we are
208
208
  # mocking?
209
209
  def singleton?(method_name)
210
- @obj.methods(false).include?(method_name.to_s)
210
+ @obj.singleton_methods.include?(method_name.to_s)
211
211
  end
212
212
 
213
213
  # Hide the existing method definition with a singleton defintion
@@ -244,17 +244,24 @@ class FlexMock
244
244
  # alias name. If the aliasing process fails (because the method
245
245
  # doesn't really exist, then return nil.
246
246
  def create_alias_for_existing_method(method_name)
247
- begin
248
- new_alias = new_name(method_name)
249
- unless @obj.respond_to?(new_alias)
250
- sclass.class_eval do
251
- alias_method(new_alias, method_name)
252
- end
247
+ new_alias = new_name(method_name)
248
+ unless @obj.respond_to?(new_alias)
249
+ safe_alias_method(new_alias, method_name)
250
+ end
251
+ new_alias
252
+ end
253
+
254
+ # Create an alias for the existing method named +method_name+. It
255
+ # is possible that +method_name+ is implemented via a
256
+ # meta-programming, so we provide for the case that the
257
+ # method_name does not exist.
258
+ def safe_alias_method(new_alias, method_name)
259
+ sclass.class_eval do
260
+ begin
261
+ alias_method(new_alias, method_name)
262
+ rescue NameError => ex
263
+ nil
253
264
  end
254
- new_alias
255
- rescue NameError => _
256
- # Alias attempt failed
257
- nil
258
265
  end
259
266
  end
260
267
 
@@ -283,12 +290,17 @@ class FlexMock
283
290
  # Restore the original singleton defintion for method_name that
284
291
  # was saved earlier.
285
292
  def restore_original_definition(method_name)
286
- method_def = @method_definitions[method_name]
287
- if method_def
288
- the_alias = new_name(method_name)
289
- sclass.class_eval do
290
- alias_method(method_name, the_alias)
293
+ begin
294
+ method_def = @method_definitions[method_name]
295
+ if method_def
296
+ the_alias = new_name(method_name)
297
+ sclass.class_eval do
298
+ alias_method(method_name, the_alias)
299
+ end
291
300
  end
301
+ rescue NameError => _
302
+ # Alias attempt failed
303
+ nil
292
304
  end
293
305
  end
294
306
 
@@ -5,7 +5,7 @@ class FlexMock
5
5
  MINOR = 0,
6
6
  BUILD = 0,
7
7
  BETA = 'beta',
8
- REV = 1,
8
+ BETAREV = 2,
9
9
  ]
10
10
  end
11
11
 
@@ -269,7 +269,24 @@ class TestStubbing < Test::Unit::TestCase
269
269
  assert ! dog.respond_to?(sym), "should not have :#{sym} defined"
270
270
  end
271
271
  end
272
-
272
+
273
+ # This test ensures that singleton? does not use the old methods(false)
274
+ # call that has fallen out of favor in Ruby 1.9. In multiple 1.9 releases
275
+ # Delegator#methods will not even accept the optional argument, making flexmock
276
+ # explode. Since there is a way to get singleton methods officially we might
277
+ # as well just do it, right?
278
+ class NoMethods
279
+ def methods(arg = true)
280
+ raise "Should not be called in the test lifecycle"
281
+ end
282
+ end
283
+
284
+ def test_object_methods_method_is_not_used_in_singleton_checks
285
+ obj = NoMethods.new
286
+ def obj.mock() :original end
287
+ assert_nothing_raised { flexmock(obj) }
288
+ end
289
+
273
290
  def test_partial_mocks_with_mock_method_singleton_colision_have_original_defs_restored
274
291
  dog = Dog.new
275
292
  def dog.mock() :original end
@@ -343,6 +360,25 @@ class TestStubbing < Test::Unit::TestCase
343
360
  assert_equal :xyzzy, liar.not_defined
344
361
  end
345
362
 
363
+ class MetaDog < Dog
364
+ def method_missing(method, *args, &block)
365
+ if method.to_s =~ /meow/
366
+ :meow
367
+ else
368
+ super
369
+ end
370
+ end
371
+ def respond_to_missing?(method, *)
372
+ method =~ /meow/ || super
373
+ end
374
+ end
375
+
376
+ def test_partial_mock_where_method_created_by_method_missing_and_respond_to_missing
377
+ dog = MetaDog.new
378
+ flexmock(dog, :meow => :hiss)
379
+ assert_equal :hiss, dog.meow
380
+ end
381
+
346
382
  # The following test was suggested by Pat Maddox for the RSpec
347
383
  # mocks. Evidently the (poorly implemented) == method caused issues
348
384
  # with RSpec Mock's internals. I'm just double checking for any
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: flexmock
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 1.0.0.beta.1
5
+ version: 1.0.0.beta.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jim Weirich
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-08-21 00:00:00 Z
13
+ date: 2012-08-22 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: "\n FlexMock is a extremely simple mock object class compatible\n with the Test::Unit framework. Although the FlexMock's\n interface is simple, it is very flexible.\n "