flexmock 0.6.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +8 -0
- data/README +116 -3
- data/Rakefile +5 -5
- data/TAGS +396 -282
- data/doc/releases/flexmock-0.7.0.rdoc +138 -0
- data/lib/flexmock/base.rb +2 -1
- data/lib/flexmock/core.rb +30 -29
- data/lib/flexmock/core_class_methods.rb +21 -30
- data/lib/flexmock/deprecated_methods.rb +62 -0
- data/lib/flexmock/expectation.rb +101 -21
- data/lib/flexmock/expectation_director.rb +10 -5
- data/lib/flexmock/mock_container.rb +144 -29
- data/lib/flexmock/ordering.rb +51 -0
- data/lib/flexmock/partial_mock.rb +23 -22
- data/test/asserts.rb +34 -0
- data/test/redirect_error.rb +16 -0
- data/test/rspec_integration/integration_spec.rb +6 -0
- data/test/test_demeter_mocking.rb +129 -0
- data/test/{test_mock.rb → test_deprecated_methods.rb} +64 -17
- data/test/test_example.rb +4 -3
- data/test/test_extended_should_receive.rb +1 -1
- data/test/test_flexmodel.rb +17 -1
- data/test/test_naming.rb +43 -8
- data/test/test_new_instances.rb +2 -22
- data/test/test_partial_mock.rb +19 -19
- data/test/test_record_mode.rb +27 -38
- data/test/test_should_receive.rb +199 -27
- metadata +11 -4
data/CHANGES
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
= Changes for FlexMock
|
2
2
|
|
3
|
+
== Pre-Version 0.7.0
|
4
|
+
|
5
|
+
* Added +and_yield+ as an expectation clause.
|
6
|
+
* Inspect on Mocks now yield a more consise description.
|
7
|
+
* Global ordering across all mocks in a container is now allowed.
|
8
|
+
* Added support for Demeter chain mocking.
|
9
|
+
* Deprecated a number of mock_* methods.
|
10
|
+
|
3
11
|
== Version 0.6.4
|
4
12
|
|
5
13
|
* Renamed flexmodel(...) to flexmock(:model, ...) because visually
|
data/README
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
FlexMock is a simple, but flexible, mock object library for Ruby unit
|
4
4
|
testing.
|
5
5
|
|
6
|
-
Version :: 0.
|
6
|
+
Version :: 0.7.0
|
7
7
|
|
8
8
|
= Links
|
9
9
|
|
@@ -82,7 +82,9 @@ include.
|
|
82
82
|
|
83
83
|
== RSpec Integration
|
84
84
|
|
85
|
-
FlexMock also supports integration with the RSpec behavior
|
85
|
+
FlexMock also supports integration with the RSpec behavior
|
86
|
+
specification framework. Starting with version 0.9.0 of RSpec, you
|
87
|
+
will be able to say:
|
86
88
|
|
87
89
|
Spec::Runner.configure do |config|
|
88
90
|
config.mock_with :flexmock
|
@@ -184,9 +186,14 @@ See FlexMock::MockContainer#flexmock for more details.
|
|
184
186
|
* new_record? -- returns false.
|
185
187
|
* errors -- returns an empty (mocked) errors object.
|
186
188
|
* is_a?(other) -- returns true if other == YourModel.
|
189
|
+
* instance_of?(class) -- returns true if class == YourModel
|
190
|
+
* kind_of?(class) -- returns true if class is YourModel or one of its ancestors
|
187
191
|
* class -- returns YourModel.
|
188
192
|
|
189
|
-
<b>NOTE:</b>
|
193
|
+
<b>NOTE:</b> Versions of FlexMock prior to 0.6.0 used +flexstub+ to
|
194
|
+
create partial mocks. The +flexmock+ method now assumes all the
|
195
|
+
functionality that was spread out between two different methods.
|
196
|
+
+flexstub+ is still available for backward compatibility.
|
190
197
|
|
191
198
|
=== Expectation Declarators
|
192
199
|
|
@@ -289,6 +296,33 @@ object. See theFlexMock::Expectation for more details.
|
|
289
296
|
supplied arguments. If +exception+ is an instance of an exception
|
290
297
|
class, then it will be raised directly.
|
291
298
|
|
299
|
+
* <b>raises( ... )</b>
|
300
|
+
|
301
|
+
Alias for <tt>and_raise</tt>.
|
302
|
+
|
303
|
+
* <b>and_throw(symbol)</b>
|
304
|
+
* <b>and_throw(symbol, value)</b>
|
305
|
+
|
306
|
+
Declares that the expected messsage will throw the specified symbol.
|
307
|
+
If an optional value is included, then it will be the value returned
|
308
|
+
from the corresponding catch statement.
|
309
|
+
|
310
|
+
* <b>throws( ... )</b>
|
311
|
+
|
312
|
+
Alias for <tt>and_throw</tt>.
|
313
|
+
|
314
|
+
* <b>and_yield(values, ...)</b>
|
315
|
+
|
316
|
+
Declares that the mocked method will receive a block, and the mock
|
317
|
+
will call that block with the values given. Not providing a block
|
318
|
+
will be an error. Providing more than one +and_yield+ clause one a
|
319
|
+
single expectation will mean that subsquent mock method calls will
|
320
|
+
yield the values provided by the additional +and_yield+ clause.
|
321
|
+
|
322
|
+
* <b>yields( ... )</b>
|
323
|
+
|
324
|
+
Alias for <tt>and_yield( ... )</tt>.
|
325
|
+
|
292
326
|
* <b>zero_or_more_times</b>
|
293
327
|
|
294
328
|
Declares that the expected message is may be sent zero or more times
|
@@ -336,6 +370,10 @@ object. See theFlexMock::Expectation for more details.
|
|
336
370
|
declared ordered messages. Unordered messages are ignored when considering
|
337
371
|
the message order.
|
338
372
|
|
373
|
+
Normally ordering is performed only against calls in the same mock
|
374
|
+
object. If the "globally" adjective is used, then ordering is
|
375
|
+
performed against the other globally ordered method calls.
|
376
|
+
|
339
377
|
* <b>ordered(<em>group</em>)</b>
|
340
378
|
|
341
379
|
Declare that the expected message belongs to an order group. Methods within
|
@@ -354,6 +392,19 @@ object. See theFlexMock::Expectation for more details.
|
|
354
392
|
m.should_receive(:flop).ordered(:flip_flop_group)
|
355
393
|
m.should_receive(:end).ordered
|
356
394
|
|
395
|
+
Normally ordering is performed only against calls in the same mock
|
396
|
+
object. If the "globally" adjective is used, then ordering is
|
397
|
+
performed against the other globally ordered method calls.
|
398
|
+
|
399
|
+
* <b>globally.ordered</b>
|
400
|
+
* <b>globally.ordered(<em>group_name</em>)</b>
|
401
|
+
|
402
|
+
When modified by the "globally" adjective, the mock call will be
|
403
|
+
ordered against other globally ordered methods in any of the mock
|
404
|
+
objects in the same container (i.e. same test). All the options of
|
405
|
+
the per-mock ordering are available in the globally ordered method
|
406
|
+
calls.
|
407
|
+
|
357
408
|
* <b>mock</b>
|
358
409
|
|
359
410
|
Expectation constraints always return the expectation so that the
|
@@ -363,6 +414,10 @@ object. See theFlexMock::Expectation for more details.
|
|
363
414
|
|
364
415
|
m = flexmock.should_receive(:hello).once.and_return("World").mock
|
365
416
|
|
417
|
+
<b>NOTE:</b> <em>Using <b>mock</b> when specifying a Demeter mock
|
418
|
+
chain will return the last mock of the chain, which might not be
|
419
|
+
what you expect.
|
420
|
+
|
366
421
|
=== Argument Validation
|
367
422
|
|
368
423
|
The values passed to the +with+ declarator determine the criteria for matching
|
@@ -557,6 +612,64 @@ methods at the same time. E.g.
|
|
557
612
|
m.should_receive(:wag).at_least.once.and_return(:happy)
|
558
613
|
end
|
559
614
|
|
615
|
+
=== Mocking Law of Demeter Violations
|
616
|
+
|
617
|
+
The Law of Demeter says that you should only invoke methods on objects
|
618
|
+
to which you have a direct connection, e.g. parameters, instance
|
619
|
+
variables, and local variables. You can usually detect Law of Demeter
|
620
|
+
violations by the excessive number of periods in an expression. For
|
621
|
+
example:
|
622
|
+
|
623
|
+
car.chassis.axle.universal_joint.cog.turn
|
624
|
+
|
625
|
+
The Law of Demeter has a very big impact on mocking. If you need to
|
626
|
+
mock the "turn" method on "cog", you first have to mock chassis, axle,
|
627
|
+
and universal_joint.
|
628
|
+
|
629
|
+
# Manually mocking a Law of Demeter violation
|
630
|
+
cog = flexmock("cog")
|
631
|
+
cog.should_receive(:turn).once.and_return(:ok)
|
632
|
+
joint = flexmock("gear", :cog => cog)
|
633
|
+
axle = flexmock("axle", :universal_joint => joint)
|
634
|
+
chassis = flexmock("chassis", :axle => axle)
|
635
|
+
car = flexmock("car", :chassis => chassis)
|
636
|
+
|
637
|
+
Yuck!
|
638
|
+
|
639
|
+
The best course of action is to avoid Law of Demeter violations. Then
|
640
|
+
your mocking exploits will be very simple. However, sometimes you
|
641
|
+
have to deal with code that already has a Demeter chain of method
|
642
|
+
calls. So for those cases where you can't avoid it, FlexMock will
|
643
|
+
allow you to easily mock Demeter method chains.
|
644
|
+
|
645
|
+
Here's an example of Demeter chain mocking:
|
646
|
+
|
647
|
+
# Demeter chain mocking using the short form.
|
648
|
+
car = flexmock("car")
|
649
|
+
car.should_receive( "chassis.axle.universal_joint.cog.turn" => :ok).once
|
650
|
+
|
651
|
+
You can also use the long form:
|
652
|
+
|
653
|
+
# Demeter chain mocking using the long form.
|
654
|
+
car = flexmock("car")
|
655
|
+
car.should_receive("chassis.axle.universal_joint.cog.turn").once.
|
656
|
+
and_return(:ok)
|
657
|
+
|
658
|
+
That's it. Anywhere FlexMock accepts a method name for mocking, you
|
659
|
+
can use a demeter chain and FlexMock will attempt to do the right
|
660
|
+
thing.
|
661
|
+
|
662
|
+
But beware, there are a few limitations.
|
663
|
+
|
664
|
+
The all the methods in the chain, except for the last one, will mocked
|
665
|
+
to return a mock object. That mock object, in turn, will be mocked so
|
666
|
+
as to respond to the next method in the chain, returning the following
|
667
|
+
mock. And so on. If you try to manually mock out any of the chained
|
668
|
+
methods, you could easily interfer with the mocking specified by the
|
669
|
+
Demeter chain. FlexMock will attempt to catch problems when it can,
|
670
|
+
but there are certainly scenarios where it cannot detect the problem
|
671
|
+
beforehand.
|
672
|
+
|
560
673
|
== Examples
|
561
674
|
|
562
675
|
=== Create a simple mock object that returns a value for a set of method calls
|
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ require 'rake/contrib/rubyforgepublisher'
|
|
19
19
|
CLEAN.include('*.tmp')
|
20
20
|
CLOBBER.include("html", 'pkg')
|
21
21
|
|
22
|
-
PKG_VERSION = '0.
|
22
|
+
PKG_VERSION = '0.7.0'
|
23
23
|
|
24
24
|
PKG_FILES = FileList[
|
25
25
|
'[A-Z]*',
|
@@ -45,7 +45,7 @@ task :ta => [:test_all]
|
|
45
45
|
|
46
46
|
Rake::TestTask.new do |t|
|
47
47
|
t.pattern = 'test/test*.rb'
|
48
|
-
t.verbose =
|
48
|
+
t.verbose = false
|
49
49
|
t.warning = true
|
50
50
|
end
|
51
51
|
|
@@ -56,11 +56,11 @@ Rake::TestTask.new(:test_extended) do |t|
|
|
56
56
|
end
|
57
57
|
|
58
58
|
task :rspec do
|
59
|
-
ENV['RUBYLIB'] = "/Users/jim/working/svn/software/
|
59
|
+
ENV['RUBYLIB'] = "/Users/jim/working/svn/software/flexmock/lib"
|
60
60
|
sh 'echo $RUBYLIB'
|
61
|
-
|
61
|
+
sh "spec test/rspec_integration/*_spec.rb" rescue nil
|
62
62
|
puts
|
63
|
-
puts "*** There should be
|
63
|
+
puts "*** There should be three failures in the above report. ***"
|
64
64
|
puts
|
65
65
|
end
|
66
66
|
|
data/TAGS
CHANGED
@@ -34,29 +34,33 @@ lib/flexmock/base.rb,0
|
|
34
34
|
lib/flexmock/composite.rb,30
|
35
35
|
class FlexMockFlexMock8,133
|
36
36
|
|
37
|
-
lib/flexmock/core.rb,
|
38
|
-
class FlexMockFlexMock
|
39
|
-
|
40
|
-
|
41
|
-
def
|
42
|
-
def
|
43
|
-
def
|
44
|
-
def
|
45
|
-
def
|
46
|
-
def
|
47
|
-
def
|
48
|
-
def
|
49
|
-
def
|
50
|
-
def
|
51
|
-
def
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
def
|
59
|
-
def
|
37
|
+
lib/flexmock/core.rb,853
|
38
|
+
class FlexMockFlexMock45,1264
|
39
|
+
class UsageError < RuntimeErrorUsageError49,1351
|
40
|
+
class MockError < RuntimeErrorMockError52,1392
|
41
|
+
def initialize(name="unknown", container=nil)initialize61,1667
|
42
|
+
def inspectinspect71,1961
|
43
|
+
def flexmock_verifyflexmock_verify77,2121
|
44
|
+
def flexmock_teardownflexmock_teardown88,2362
|
45
|
+
def should_ignore_missingshould_ignore_missing92,2442
|
46
|
+
def method_missing(sym, *args, &block)method_missing98,2617
|
47
|
+
def respond_to?(sym)respond_to?113,3054
|
48
|
+
def flexmock_find_expectation(sym, *args)flexmock_find_expectation118,3203
|
49
|
+
def method(sym)method124,3393
|
50
|
+
def should_receive(*args)should_receive153,4413
|
51
|
+
def should_expectshould_expect175,5112
|
52
|
+
def flexmock_wrap(&block)flexmock_wrap183,5302
|
53
|
+
def override_existing_method(sym)override_existing_method197,5861
|
54
|
+
def sclasssclass206,6081
|
55
|
+
|
56
|
+
lib/flexmock/core_class_methods.rb,289
|
57
|
+
class FlexMockFlexMock15,371
|
58
|
+
def use(*names)use39,1312
|
59
|
+
def format_args(sym, args) # :nodoc:format_args53,1710
|
60
|
+
def check(msg, &block) # :nodoc:check63,2011
|
61
|
+
class UseContainerUseContainer70,2186
|
62
|
+
def initializeinitialize75,2276
|
63
|
+
def passed?passed?79,2337
|
60
64
|
|
61
65
|
lib/flexmock/default_framework_adapter.rb,345
|
62
66
|
class FlexMockFlexMock14,337
|
@@ -66,84 +70,119 @@ class FlexMockFlexMock14,337
|
|
66
70
|
class AssertionFailedError < StandardError; endAssertionFailedError26,597
|
67
71
|
def assertion_failed_errorassertion_failed_error27,649
|
68
72
|
|
69
|
-
lib/flexmock/
|
73
|
+
lib/flexmock/deprecated_methods.rb,340
|
74
|
+
class ModuleModule13,314
|
75
|
+
def flexmock_deprecate(*method_names)flexmock_deprecate14,327
|
76
|
+
class FlexMockFlexMock33,827
|
77
|
+
def mock_handle(sym, expected_count=nil, &block) # :nodoc:mock_handle40,1125
|
78
|
+
class PartialMockProxyPartialMockProxy47,1415
|
79
|
+
def any_instance(&block)any_instance53,1572
|
80
|
+
module OrderingOrdering59,1720
|
81
|
+
|
82
|
+
lib/flexmock/expectation.rb,1895
|
70
83
|
class FlexMockFlexMock14,337
|
71
84
|
class ExpectationExpectation28,872
|
72
85
|
def initialize(mock, sym)initialize34,1018
|
73
|
-
def to_sto_s
|
74
|
-
def verify_call(*args)verify_call
|
75
|
-
def
|
76
|
-
def
|
77
|
-
def
|
78
|
-
def
|
79
|
-
def
|
80
|
-
def
|
81
|
-
def
|
82
|
-
def
|
83
|
-
def
|
84
|
-
def
|
85
|
-
def
|
86
|
-
def
|
87
|
-
def
|
88
|
-
def
|
89
|
-
def
|
90
|
-
def
|
91
|
-
def
|
92
|
-
def
|
93
|
-
|
94
|
-
def
|
95
|
-
def
|
96
|
-
def
|
97
|
-
def
|
98
|
-
def
|
99
|
-
def
|
100
|
-
|
101
|
-
|
102
|
-
def
|
103
|
-
def method_missing(sym, *args, &block)method_missing
|
104
|
-
def
|
105
|
-
|
106
|
-
|
86
|
+
def to_sto_s49,1380
|
87
|
+
def verify_call(*args)verify_call55,1562
|
88
|
+
def _return_value(args) # :nodoc:_return_value64,1782
|
89
|
+
def return_value(args)return_value69,1922
|
90
|
+
def perform_yielding(args)perform_yielding83,2245
|
91
|
+
def eligible?eligible?99,2822
|
92
|
+
def validate_ordervalidate_order104,2943
|
93
|
+
def flexmock_verifyflexmock_verify116,3318
|
94
|
+
def match_args(args)match_args124,3515
|
95
|
+
def match_arg(expected, actual)match_arg133,3861
|
96
|
+
def with(*args)with140,4090
|
97
|
+
def with_no_argswith_no_args146,4224
|
98
|
+
def with_any_argswith_any_args152,4357
|
99
|
+
def and_return(*args, &block)and_return183,5366
|
100
|
+
def and_yield(*yield_values)and_yield195,5618
|
101
|
+
def and_raise(exception, *args)and_raise219,6381
|
102
|
+
def and_throw(sym, value=nil)and_throw233,6746
|
103
|
+
def zero_or_more_timeszero_or_more_times239,6921
|
104
|
+
def times(limit)times246,7144
|
105
|
+
def nevernever255,7491
|
106
|
+
def onceonce262,7706
|
107
|
+
def twicetwice269,7921
|
108
|
+
def at_leastat_least281,8247
|
109
|
+
def at_mostat_most294,8626
|
110
|
+
def ordered(group_name=nil)ordered323,9895
|
111
|
+
def globallyglobally335,10275
|
112
|
+
def define_ordered(group_name, ordering)define_ordered341,10390
|
113
|
+
class CompositeExpectationCompositeExpectation361,11145
|
114
|
+
def initializeinitialize364,11219
|
115
|
+
def add(expectation)add369,11315
|
116
|
+
def method_missing(sym, *args, &block)method_missing374,11456
|
117
|
+
def order_numberorder_number385,11835
|
118
|
+
def mockmock390,11945
|
119
|
+
def should_receive(*args, &block)should_receive396,12113
|
120
|
+
def to_sto_s401,12259
|
121
|
+
class ExpectationRecorderExpectationRecorder415,12717
|
122
|
+
def initializeinitialize418,12777
|
123
|
+
def method_missing(sym, *args, &block)method_missing423,12888
|
124
|
+
def apply(mock)apply431,13164
|
125
|
+
|
126
|
+
lib/flexmock/expectation_director.rb,301
|
107
127
|
class FlexMockFlexMock14,337
|
108
128
|
class ExpectationDirectorExpectationDirector20,549
|
109
129
|
def initialize(sym)initialize23,633
|
110
130
|
def call(*args)call37,1161
|
111
|
-
def
|
112
|
-
def
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
def
|
119
|
-
def
|
120
|
-
def
|
121
|
-
def
|
122
|
-
def
|
123
|
-
|
131
|
+
def find_expectation(*args)find_expectation45,1424
|
132
|
+
def <<(expectation)<<51,1639
|
133
|
+
def flexmock_verifyflexmock_verify57,1798
|
134
|
+
|
135
|
+
lib/flexmock/mock_container.rb,882
|
136
|
+
class FlexMockFlexMock15,371
|
137
|
+
module MockContainerMockContainer25,777
|
138
|
+
def flexmock_teardownflexmock_teardown30,961
|
139
|
+
def flexmock_verifyflexmock_verify37,1119
|
140
|
+
def flexmock_closeflexmock_close46,1414
|
141
|
+
def flexmock(*args)flexmock115,4684
|
142
|
+
def flexmock_remember(mocking_object)flexmock_remember157,5960
|
143
|
+
class MockContainerHelperMockContainerHelper173,6610
|
144
|
+
def next_idnext_id177,6719
|
145
|
+
def parse_should_args(mock, args, &block) # :nodoc:parse_should_args190,7188
|
146
|
+
def add_model_methods(mock, model_class, id)add_model_methods208,7701
|
147
|
+
def make_partial_proxy(container, obj, name, safe_mode)make_partial_proxy229,8439
|
148
|
+
def build_demeter_chain(mock, arg, &block)build_demeter_chain274,10292
|
149
|
+
def check_proper_mock(mock, method_name)check_proper_mock299,11143
|
150
|
+
def check_method_names(names)check_method_names307,11434
|
124
151
|
|
125
152
|
lib/flexmock/noop.rb,0
|
126
153
|
|
127
|
-
lib/flexmock/
|
154
|
+
lib/flexmock/ordering.rb,399
|
155
|
+
class FlexMockFlexMock12,312
|
156
|
+
module OrderingOrdering20,684
|
157
|
+
def flexmock_allocate_orderflexmock_allocate_order23,751
|
158
|
+
def flexmock_groupsflexmock_groups29,914
|
159
|
+
def flexmock_current_orderflexmock_current_order34,1022
|
160
|
+
def flexmock_current_order=(value)flexmock_current_order=39,1145
|
161
|
+
def flexmock_validate_order(method_name, order_number)flexmock_validate_order43,1231
|
162
|
+
|
163
|
+
lib/flexmock/partial_mock.rb,1298
|
128
164
|
class FlexMockFlexMock14,337
|
129
|
-
class
|
130
|
-
def initialize(obj, mock)initialize
|
131
|
-
def
|
132
|
-
def
|
133
|
-
def
|
134
|
-
def
|
135
|
-
def
|
136
|
-
def
|
137
|
-
def
|
138
|
-
def
|
139
|
-
def
|
140
|
-
def
|
141
|
-
def
|
142
|
-
def
|
143
|
-
def
|
144
|
-
def
|
145
|
-
def
|
146
|
-
def
|
165
|
+
class PartialMockProxyPartialMockProxy26,968
|
166
|
+
def initialize(obj, mock, safe_mode)initialize40,1310
|
167
|
+
def flexmock_getflexmock_get53,1620
|
168
|
+
def should_receive(*args)should_receive77,2560
|
169
|
+
def add_mock_method(obj, method_name)add_mock_method88,2838
|
170
|
+
def new_instances(*allocators, &block)new_instances114,3788
|
171
|
+
def invoke_original(method, args)invoke_original132,4419
|
172
|
+
def flexmock_verifyflexmock_verify140,4713
|
173
|
+
def flexmock_teardownflexmock_teardown145,4849
|
174
|
+
def flexmock_containerflexmock_container157,5187
|
175
|
+
def flexmock_container=(container)flexmock_container=163,5382
|
176
|
+
def sclasssclass169,5484
|
177
|
+
def singleton?(method_name)singleton?175,5625
|
178
|
+
def hide_existing_method(method_name)hide_existing_method185,6087
|
179
|
+
def stow_existing_definition(method_name)stow_existing_definition192,6304
|
180
|
+
def create_alias_for_existing_method(method_name)create_alias_for_existing_method212,7021
|
181
|
+
def define_proxy_method(method_name)define_proxy_method230,7540
|
182
|
+
def restore_original_definition(method_name)restore_original_definition251,8240
|
183
|
+
def remove_current_method(method_name)remove_current_method263,8604
|
184
|
+
def detached?detached?268,8765
|
185
|
+
def new_name(old_name)new_name273,8873
|
147
186
|
|
148
187
|
lib/flexmock/recorder.rb,271
|
149
188
|
class FlexMockFlexMock14,347
|
@@ -187,7 +226,17 @@ class FlexMockFlexMock14,337
|
|
187
226
|
class AtMostCountValidator < CountValidatorAtMostCountValidator69,2058
|
188
227
|
def validate(n)validate71,2173
|
189
228
|
|
190
|
-
test/
|
229
|
+
test/asserts.rb,139
|
230
|
+
class FlexMockFlexMock12,312
|
231
|
+
module FailureAssertionFailureAssertion15,368
|
232
|
+
def assert_failure(message=nil)assert_failure21,567
|
233
|
+
|
234
|
+
test/redirect_error.rb,114
|
235
|
+
class FlexMockFlexMock3,20
|
236
|
+
module RedirectErrorRedirectError4,35
|
237
|
+
def redirect_errorredirect_error5,58
|
238
|
+
|
239
|
+
test/test_container_methods.rb,1111
|
191
240
|
class TestFlexmockContainerMethods < Test::Unit::TestCaseTestFlexmockContainerMethods16,410
|
192
241
|
def test_simple_mock_creationtest_simple_mock_creation19,498
|
193
242
|
def test_mock_with_nametest_mock_with_name25,639
|
@@ -201,8 +250,8 @@ class TestFlexmockContainerMethods < Test::Unit::TestCaseTestFlexmockContainerM
|
|
201
250
|
def test_stub_with_name_quick_definitionstest_stub_with_name_quick_definitions83,2305
|
202
251
|
def test_stubs_are_auto_verifiedtest_stubs_are_auto_verified92,2629
|
203
252
|
def test_stubbing_a_stringtest_stubbing_a_string99,2831
|
204
|
-
def
|
205
|
-
def test_multiple_stubs_layer_behaviortest_multiple_stubs_layer_behavior112,
|
253
|
+
def test_multiple_stubs_work_with_same_partial_mock_proxytest_multiple_stubs_work_with_same_partial_mock_proxy105,2958
|
254
|
+
def test_multiple_stubs_layer_behaviortest_multiple_stubs_layer_behavior112,3130
|
206
255
|
|
207
256
|
test/test_default_framework_adapter.rb,475
|
208
257
|
class TestFlexmockDefaultFrameworkAdapter < Test::Unit::TestCaseTestFlexmockDefaultFrameworkAdapter15,352
|
@@ -212,92 +261,130 @@ class TestFlexmockDefaultFrameworkAdapter < Test::Unit::TestCaseTestFlexmockDef
|
|
212
261
|
def test_assert_equal_doesnt_raise_exceptiontest_assert_equal_doesnt_raise_exception30,794
|
213
262
|
def test_assert_equal_can_failtest_assert_equal_can_fail34,900
|
214
263
|
|
264
|
+
test/test_demeter_mocking.rb,1377
|
265
|
+
class TestDemeterMocking < Test::Unit::TestCaseTestDemeterMocking7,84
|
266
|
+
def test_demeter_mockingtest_demeter_mocking11,199
|
267
|
+
def test_multiple_demeter_mocks_on_same_branch_is_oktest_multiple_demeter_mocks_on_same_branch_is_ok19,426
|
268
|
+
def test_multi_level_deep_demeter_violationtest_multi_level_deep_demeter_violation27,718
|
269
|
+
def test_final_method_can_have_multiple_expecationstest_final_method_can_have_multiple_expecations33,903
|
270
|
+
def test_conflicting_mock_declarations_raises_an_errortest_conflicting_mock_declarations_raises_an_error41,1194
|
271
|
+
def test_conflicting_mock_declarations_in_reverse_order_does_not_raise_errortest_conflicting_mock_declarations_in_reverse_order_does_not_raise_error53,1599
|
272
|
+
def test_preestablishing_existing_mock_is_oktest_preestablishing_existing_mock_is_ok63,1943
|
273
|
+
def test_quick_defs_can_use_demeter_mockingtest_quick_defs_can_use_demeter_mocking71,2206
|
274
|
+
def test_quick_defs_can_use_demeter_mocking_twotest_quick_defs_can_use_demeter_mocking_two81,2515
|
275
|
+
def test_errors_on_ill_formed_method_namestest_errors_on_ill_formed_method_names88,2744
|
276
|
+
def test_no_errors_on_well_formed_method_namestest_no_errors_on_well_formed_method_names97,2998
|
277
|
+
def test_readme_example_1test_readme_example_1106,3216
|
278
|
+
def test_readme_example_2test_readme_example_2116,3590
|
279
|
+
def test_readme_example_3test_readme_example_3122,3791
|
280
|
+
|
281
|
+
test/test_deprecated_methods.rb,2237
|
282
|
+
class TestFlexMock < Test::Unit::TestCaseTestFlexMock17,420
|
283
|
+
def s(&block)s21,526
|
284
|
+
def setupsetup25,576
|
285
|
+
def test_handletest_handle29,624
|
286
|
+
def test_handle_no_blocktest_handle_no_block36,768
|
287
|
+
def test_called_with_blocktest_called_with_block42,898
|
288
|
+
def test_return_valuetest_return_value49,1096
|
289
|
+
def test_handle_missing_methodtest_handle_missing_method54,1201
|
290
|
+
def test_ignore_missing_methodtest_ignore_missing_method62,1426
|
291
|
+
def test_good_countstest_good_counts68,1557
|
292
|
+
def test_bad_countstest_bad_counts76,1696
|
293
|
+
def test_undetermined_countstest_undetermined_counts87,1913
|
294
|
+
def test_zero_countstest_zero_counts96,2058
|
295
|
+
def test_file_io_with_usetest_file_io_with_use105,2237
|
296
|
+
def count_lines(stream)count_lines113,2441
|
297
|
+
def test_usetest_use121,2559
|
298
|
+
def test_failures_during_usetest_failures_during_use130,2716
|
299
|
+
def test_sequential_valuestest_sequential_values140,2935
|
300
|
+
def test_respond_to_returns_false_for_non_handled_methodstest_respond_to_returns_false_for_non_handled_methods149,3169
|
301
|
+
def test_respond_to_returns_true_for_explicit_methodstest_respond_to_returns_true_for_explicit_methods153,3304
|
302
|
+
def test_respond_to_returns_true_for_missing_methods_when_ignoring_missingtest_respond_to_returns_true_for_missing_methods_when_ignoring_missing158,3463
|
303
|
+
def test_respond_to_returns_true_for_missing_methods_when_ignoring_missing_using_shouldtest_respond_to_returns_true_for_missing_methods_when_ignoring_missing_using_should163,3644
|
304
|
+
def test_method_proc_raises_error_on_unknowntest_method_proc_raises_error_on_unknown168,3840
|
305
|
+
def test_method_returns_callable_proctest_method_returns_callable_proc174,3958
|
306
|
+
def test_method_returns_do_nothing_proc_for_missing_methodstest_method_returns_do_nothing_proc_for_missing_methods183,4214
|
307
|
+
class TestDeprecatedOrderingMethods < Test::Unit::TestCaseTestDeprecatedOrderingMethods191,4408
|
308
|
+
def test_deprecated_ordering_methodstest_deprecated_ordering_methods195,4531
|
309
|
+
class TestAnyInstance < Test::Unit::TestCaseTestAnyInstance207,4927
|
310
|
+
class DogDog211,5036
|
311
|
+
def barkbark212,5048
|
312
|
+
def test_any_instance_still_works_for_backwards_compatibilitytest_any_instance_still_works_for_backwards_compatibility217,5088
|
313
|
+
|
215
314
|
test/test_example.rb,278
|
216
315
|
class TemperatureSamplerTemperatureSampler15,352
|
217
316
|
def initialize(sensor)initialize16,377
|
218
317
|
def average_tempaverage_temp20,430
|
219
|
-
class TestTemperatureSampler < Test::Unit::TestCaseTestTemperatureSampler
|
220
|
-
def test_tempurature_samplertest_tempurature_sampler
|
318
|
+
class TestTemperatureSampler < Test::Unit::TestCaseTestTemperatureSampler26,557
|
319
|
+
def test_tempurature_samplertest_tempurature_sampler29,639
|
221
320
|
|
222
|
-
test/test_extended_should_receive.rb,
|
321
|
+
test/test_extended_should_receive.rb,809
|
223
322
|
module ExtendedShouldReceiveTestsExtendedShouldReceiveTests15,352
|
224
323
|
def test_accepts_expectation_hashtest_accepts_expectation_hash16,386
|
225
324
|
def test_accepts_list_of_methodstest_accepts_list_of_methods22,552
|
226
325
|
def test_contraints_apply_to_all_expectationstest_contraints_apply_to_all_expectations29,712
|
227
326
|
def test_count_contraints_apply_to_all_expectationstest_count_contraints_apply_to_all_expectations36,1001
|
228
|
-
def test_multiple_should_receives_are_allowedtest_multiple_should_receives_are_allowed42,
|
229
|
-
class TestExtendedShouldReceiveOnFullMocks < Test::Unit::TestCaseTestExtendedShouldReceiveOnFullMocks50,
|
230
|
-
def setupsetup54,
|
231
|
-
class
|
232
|
-
def setupsetup65,
|
233
|
-
|
234
|
-
test/
|
235
|
-
class
|
236
|
-
|
237
|
-
|
238
|
-
def
|
239
|
-
def
|
240
|
-
def
|
241
|
-
def
|
242
|
-
def
|
243
|
-
|
244
|
-
|
245
|
-
def test_undetermined_countstest_undetermined_counts78,1683
|
246
|
-
def test_zero_countstest_zero_counts87,1822
|
247
|
-
def test_file_io_with_usetest_file_io_with_use96,1995
|
248
|
-
def count_lines(stream)count_lines104,2193
|
249
|
-
def test_usetest_use112,2311
|
250
|
-
def test_failures_during_usetest_failures_during_use121,2462
|
251
|
-
def test_sequential_valuestest_sequential_values131,2675
|
252
|
-
def test_respond_to_returns_false_for_non_handled_methodstest_respond_to_returns_false_for_non_handled_methods140,2903
|
253
|
-
def test_respond_to_returns_true_for_explicit_methodstest_respond_to_returns_true_for_explicit_methods144,3038
|
254
|
-
def test_respond_to_returns_true_for_missing_methods_when_ignoring_missingtest_respond_to_returns_true_for_missing_methods_when_ignoring_missing149,3191
|
255
|
-
def test_respond_to_returns_true_for_missing_methods_when_ignoring_missing_using_shouldtest_respond_to_returns_true_for_missing_methods_when_ignoring_missing_using_should154,3372
|
256
|
-
def test_method_proc_raises_error_on_unknowntest_method_proc_raises_error_on_unknown159,3568
|
257
|
-
def test_method_returns_callable_proctest_method_returns_callable_proc165,3686
|
258
|
-
def test_method_returns_do_nothing_proc_for_missing_methodstest_method_returns_do_nothing_proc_for_missing_methods174,3936
|
259
|
-
|
260
|
-
test/test_naming.rb,404
|
327
|
+
def test_multiple_should_receives_are_allowedtest_multiple_should_receives_are_allowed42,1204
|
328
|
+
class TestExtendedShouldReceiveOnFullMocks < Test::Unit::TestCaseTestExtendedShouldReceiveOnFullMocks50,1421
|
329
|
+
def setupsetup54,1556
|
330
|
+
class TestExtendedShouldReceiveOnPartialMockProxies < Test::Unit::TestCaseTestExtendedShouldReceiveOnPartialMockProxies61,1626
|
331
|
+
def setupsetup65,1770
|
332
|
+
|
333
|
+
test/test_flexmodel.rb,528
|
334
|
+
class DummyModelDummyModel5,42
|
335
|
+
class ChildModel < DummyModelChildModel8,64
|
336
|
+
class TestFlexModel < Test::Unit::TestCaseTestFlexModel12,170
|
337
|
+
def test_initial_conditionstest_initial_conditions15,243
|
338
|
+
def test_classifying_mock_modelstest_classifying_mock_models27,644
|
339
|
+
def test_mock_models_have_different_idstest_mock_models_have_different_ids37,891
|
340
|
+
def test_mock_models_can_have_quick_defstest_mock_models_can_have_quick_defs43,1042
|
341
|
+
def test_mock_models_can_have_blockstest_mock_models_can_have_blocks48,1182
|
342
|
+
|
343
|
+
test/test_naming.rb,816
|
261
344
|
class TestNaming < Test::Unit::TestCaseTestNaming15,352
|
262
|
-
def test_nametest_name
|
263
|
-
def test_name_in_no_handler_found_errortest_name_in_no_handler_found_error
|
264
|
-
def test_name_in_received_count_errortest_name_in_received_count_error
|
265
|
-
def test_naming_with_usetest_naming_with_use
|
266
|
-
def test_naming_with_multiple_mocks_in_usetest_naming_with_multiple_mocks_in_use
|
267
|
-
|
268
|
-
|
269
|
-
class
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
class
|
277
|
-
def
|
278
|
-
def
|
279
|
-
def
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
def
|
287
|
-
def
|
288
|
-
def
|
289
|
-
def
|
290
|
-
def
|
291
|
-
def
|
292
|
-
def
|
293
|
-
def
|
294
|
-
def
|
295
|
-
def
|
296
|
-
def
|
297
|
-
def
|
298
|
-
def
|
299
|
-
|
300
|
-
|
345
|
+
def test_nametest_name18,424
|
346
|
+
def test_name_in_no_handler_found_errortest_name_in_no_handler_found_error23,507
|
347
|
+
def test_name_in_received_count_errortest_name_in_received_count_error32,733
|
348
|
+
def test_naming_with_usetest_naming_with_use41,963
|
349
|
+
def test_naming_with_multiple_mocks_in_usetest_naming_with_multiple_mocks_in_use47,1080
|
350
|
+
def test_inspect_returns_reasonable_nametest_inspect_returns_reasonable_name54,1268
|
351
|
+
def test_mock_can_override_inspecttest_mock_can_override_inspect61,1452
|
352
|
+
class DummyDummy68,1655
|
353
|
+
def inspectinspect69,1669
|
354
|
+
def test_partial_mocks_use_original_inspecttest_partial_mocks_use_original_inspect74,1722
|
355
|
+
def test_partial_mocks_can_override_inspecttest_partial_mocks_can_override_inspect80,1886
|
356
|
+
|
357
|
+
test/test_new_instances.rb,2299
|
358
|
+
class TestNewInstances < Test::Unit::TestCaseTestNewInstances16,382
|
359
|
+
class DogDog20,494
|
360
|
+
def barkbark21,506
|
361
|
+
def wagwag24,539
|
362
|
+
def self.makemake27,571
|
363
|
+
class CatCat32,614
|
364
|
+
def initialize(name, &block)initialize34,648
|
365
|
+
class ConnectionConnection40,756
|
366
|
+
def initialize(*args)initialize41,775
|
367
|
+
def send(args)send44,843
|
368
|
+
def post(args)post47,887
|
369
|
+
def test_new_instances_allows_stubbing_of_existing_methodstest_new_instances_allows_stubbing_of_existing_methods52,938
|
370
|
+
def test_new_instances_stubs_still_have_existing_methodstest_new_instances_stubs_still_have_existing_methods60,1161
|
371
|
+
def test_new_instances_will_pass_args_to_newtest_new_instances_will_pass_args_to_new68,1376
|
372
|
+
def test_new_gets_block_after_restubbingtest_new_gets_block_after_restubbing81,1782
|
373
|
+
def test_new_instances_stub_verification_happens_on_teardowntest_new_instances_stub_verification_happens_on_teardown94,2107
|
374
|
+
def test_new_instances_reports_error_on_non_classestest_new_instances_reports_error_on_non_classes104,2470
|
375
|
+
def test_can_stub_objects_created_with_allocate_instead_of_newtest_can_stub_objects_created_with_allocate_instead_of_new114,2752
|
376
|
+
def test_can_stub_objects_created_with_arbitrary_class_methodstest_can_stub_objects_created_with_arbitrary_class_methods122,2984
|
377
|
+
def test_stubbing_arbitrary_class_methods_leaves_new_alonetest_stubbing_arbitrary_class_methods_leaves_new_alone129,3209
|
378
|
+
def test_stubbing_new_and_allocate_doesnt_double_stub_objects_on_newtest_stubbing_new_and_allocate_doesnt_double_stub_objects_on_new136,3424
|
379
|
+
def test_stubbing_new_and_allocate_doesnt_double_stub_objects_on_allocatetest_stubbing_new_and_allocate_doesnt_double_stub_objects_on_allocate145,3626
|
380
|
+
def test_blocks_on_new_do_not_have_stubs_installedtest_blocks_on_new_do_not_have_stubs_installed158,4093
|
381
|
+
def test_new_instances_accept_chained_expectationstest_new_instances_accept_chained_expectations172,4433
|
382
|
+
def test_fancy_use_of_chained_should_receivedtest_fancy_use_of_chained_should_received180,4705
|
383
|
+
def test_writable_accessorstest_writable_accessors185,4862
|
384
|
+
def test_ordering_can_be_specifiedtest_ordering_can_be_specified191,5009
|
385
|
+
def test_ordering_can_be_specified_in_groupstest_ordering_can_be_specified_in_groups199,5205
|
386
|
+
|
387
|
+
test/test_partial_mock.rb,4290
|
301
388
|
class TestStubbing < Test::Unit::TestCaseTestStubbing16,372
|
302
389
|
class DogDog19,446
|
303
390
|
def barkbark20,458
|
@@ -308,130 +395,157 @@ class TestStubbing < Test::Unit::TestCaseTestStubbing16,372
|
|
308
395
|
def test_multiple_stubs_on_the_same_object_reuse_the_same_partial_mocktest_multiple_stubs_on_the_same_object_reuse_the_same_partial_mock49,1152
|
309
396
|
def test_multiple_methods_can_be_stubbedtest_multiple_methods_can_be_stubbed54,1301
|
310
397
|
def test_original_behavior_can_be_restoredtest_original_behavior_can_be_restored62,1555
|
311
|
-
def test_original_missing_behavior_can_be_restoredtest_original_missing_behavior_can_be_restored72,
|
312
|
-
def test_multiple_stubs_on_single_method_can_be_restored_missing_methodtest_multiple_stubs_on_single_method_can_be_restored_missing_method81,
|
313
|
-
def test_original_behavior_is_restored_when_multiple_methods_are_mockedtest_original_behavior_is_restored_when_multiple_methods_are_mocked92,
|
314
|
-
def test_original_behavior_is_restored_on_class_objectstest_original_behavior_is_restored_on_class_objects101,
|
315
|
-
def test_original_behavior_is_restored_on_singleton_methodstest_original_behavior_is_restored_on_singleton_methods108,
|
316
|
-
def obj.hi() :hello endhi110,
|
317
|
-
def test_original_behavior_is_restored_on_singleton_methods_with_multiple_stubstest_original_behavior_is_restored_on_singleton_methods_with_multiple_stubs118,
|
318
|
-
def obj.hi(n) "hello#{n}" endhi120,
|
319
|
-
def test_original_behavior_is_restored_on_nonsingleton_methods_with_multiple_stubstest_original_behavior_is_restored_on_nonsingleton_methods_with_multiple_stubs130,
|
320
|
-
def test_stubbing_file_shouldnt_break_writingtest_stubbing_file_shouldnt_break_writing146,
|
321
|
-
def test_original_behavior_is_restored_even_when_errorstest_original_behavior_is_restored_even_when_errors162,
|
322
|
-
def m.
|
323
|
-
def test_not_calling_stubbed_method_is_an_errortest_not_calling_stubbed_method_is_an_error173,
|
324
|
-
def test_mock_is_verified_when_the_stub_is_verifiedtest_mock_is_verified_when_the_stub_is_verified182,
|
325
|
-
def test_stub_can_have_explicit_nametest_stub_can_have_explicit_name191,
|
326
|
-
def test_unamed_stub_will_use_default_naming_conventiontest_unamed_stub_will_use_default_naming_convention197,
|
327
|
-
def test_partials_can_be_defined_in_a_blocktest_partials_can_be_defined_in_a_block203,
|
328
|
-
def test_partials_defining_block_return_real_obj_not_proxytest_partials_defining_block_return_real_obj_not_proxy211,
|
329
|
-
|
330
|
-
|
331
|
-
def
|
332
|
-
def
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
def
|
339
|
-
def
|
340
|
-
def
|
341
|
-
|
342
|
-
|
343
|
-
def
|
344
|
-
def
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
def
|
349
|
-
def
|
398
|
+
def test_original_missing_behavior_can_be_restoredtest_original_missing_behavior_can_be_restored72,1892
|
399
|
+
def test_multiple_stubs_on_single_method_can_be_restored_missing_methodtest_multiple_stubs_on_single_method_can_be_restored_missing_method81,2171
|
400
|
+
def test_original_behavior_is_restored_when_multiple_methods_are_mockedtest_original_behavior_is_restored_when_multiple_methods_are_mocked92,2582
|
401
|
+
def test_original_behavior_is_restored_on_class_objectstest_original_behavior_is_restored_on_class_objects101,2911
|
402
|
+
def test_original_behavior_is_restored_on_singleton_methodstest_original_behavior_is_restored_on_singleton_methods108,3162
|
403
|
+
def obj.hi() :hello endhi110,3245
|
404
|
+
def test_original_behavior_is_restored_on_singleton_methods_with_multiple_stubstest_original_behavior_is_restored_on_singleton_methods_with_multiple_stubs118,3441
|
405
|
+
def obj.hi(n) "hello#{n}" endhi120,3544
|
406
|
+
def test_original_behavior_is_restored_on_nonsingleton_methods_with_multiple_stubstest_original_behavior_is_restored_on_nonsingleton_methods_with_multiple_stubs130,3865
|
407
|
+
def test_stubbing_file_shouldnt_break_writingtest_stubbing_file_shouldnt_break_writing146,4359
|
408
|
+
def test_original_behavior_is_restored_even_when_errorstest_original_behavior_is_restored_even_when_errors162,4798
|
409
|
+
def m.flexmock_verify() endflexmock_verify170,5117
|
410
|
+
def test_not_calling_stubbed_method_is_an_errortest_not_calling_stubbed_method_is_an_error173,5156
|
411
|
+
def test_mock_is_verified_when_the_stub_is_verifiedtest_mock_is_verified_when_the_stub_is_verified182,5385
|
412
|
+
def test_stub_can_have_explicit_nametest_stub_can_have_explicit_name191,5655
|
413
|
+
def test_unamed_stub_will_use_default_naming_conventiontest_unamed_stub_will_use_default_naming_convention197,5834
|
414
|
+
def test_partials_can_be_defined_in_a_blocktest_partials_can_be_defined_in_a_block203,6030
|
415
|
+
def test_partials_defining_block_return_real_obj_not_proxytest_partials_defining_block_return_real_obj_not_proxy211,6217
|
416
|
+
def test_partial_mocks_always_return_domain_objecttest_partial_mocks_always_return_domain_object218,6411
|
417
|
+
def test_domain_objects_do_not_have_mock_methodstest_domain_objects_do_not_have_mock_methods229,6691
|
418
|
+
def test_partial_mocks_have_mock_methodstest_partial_mocks_have_mock_methods236,6883
|
419
|
+
def test_partial_mocks_do_not_have_mock_methods_after_teardowntest_partial_mocks_do_not_have_mock_methods_after_teardown244,7079
|
420
|
+
def test_partial_mocks_with_mock_method_singleton_colision_have_original_defs_restoredtest_partial_mocks_with_mock_method_singleton_colision_have_original_defs_restored253,7329
|
421
|
+
def dog.mock() :original endmock255,7436
|
422
|
+
class MockColisionMockColision261,7557
|
423
|
+
def mockmock262,7578
|
424
|
+
def test_partial_mocks_with_mock_method_non_singleton_colision_have_original_defs_restoredtest_partial_mocks_with_mock_method_non_singleton_colision_have_original_defs_restored267,7622
|
425
|
+
def test_safe_partial_mocks_do_not_support_mock_methodstest_safe_partial_mocks_do_not_support_mock_methods274,7826
|
426
|
+
def test_safe_partial_mocks_require_blocktest_safe_partial_mocks_require_block282,8054
|
427
|
+
def test_safe_partial_mocks_are_actually_mockedtest_safe_partial_mocks_are_actually_mocked287,8192
|
428
|
+
class LiarLiar292,8362
|
429
|
+
def respond_to?(method_name)respond_to?293,8375
|
430
|
+
def test_liar_actually_liestest_liar_actually_lies303,8544
|
431
|
+
def test_partial_mock_where_respond_to_is_true_yet_method_is_not_theretest_partial_mock_where_respond_to_is_true_yet_method_is_not_there309,8696
|
432
|
+
|
433
|
+
test/test_record_mode.rb,1339
|
434
|
+
class TestRecordMode < Test::Unit::TestCaseTestRecordMode16,390
|
435
|
+
def test_recording_mode_workstest_recording_mode_works20,505
|
436
|
+
def test_arguments_are_passed_to_recording_mode_blocktest_arguments_are_passed_to_recording_mode_block28,687
|
437
|
+
def test_recording_mode_handles_multiple_returnstest_recording_mode_handles_multiple_returns39,962
|
438
|
+
def test_recording_mode_does_not_specify_ordertest_recording_mode_does_not_specify_order50,1229
|
439
|
+
def test_recording_mode_gets_block_args_tootest_recording_mode_gets_block_args_too61,1475
|
440
|
+
def test_recording_mode_should_validate_args_with_equalstest_recording_mode_should_validate_args_with_equals73,1757
|
441
|
+
def test_recording_mode_should_allow_arg_contraint_validationtest_recording_mode_should_allow_arg_contraint_validation84,1992
|
442
|
+
def test_recording_mode_should_handle_multiplicity_contraintstest_recording_mode_should_handle_multiplicity_contraints95,2233
|
443
|
+
def test_strict_record_mode_requires_exact_argument_matchestest_strict_record_mode_requires_exact_argument_matches107,2500
|
444
|
+
def test_strict_record_mode_requires_exact_orderingtest_strict_record_mode_requires_exact_ordering119,2780
|
445
|
+
def test_strict_record_mode_requires_oncetest_strict_record_mode_requires_once133,3085
|
446
|
+
def test_strict_record_mode_can_not_failtest_strict_record_mode_can_not_fail146,3360
|
350
447
|
|
351
448
|
test/test_samples.rb,142
|
352
449
|
class TestSamples < Test::Unit::TestCaseTestSamples17,378
|
353
450
|
def test_file_iotest_file_io25,748
|
354
451
|
def count_lines(file)count_lines33,999
|
355
452
|
|
356
|
-
test/test_should_receive.rb,
|
453
|
+
test/test_should_receive.rb,8729
|
357
454
|
def mock_top_level_functionmock_top_level_function15,352
|
358
455
|
module KernelKernel20,394
|
359
456
|
def mock_kernel_functionmock_kernel_function21,408
|
360
457
|
class TestFlexMockShoulds < Test::Unit::TestCaseTestFlexMockShoulds26,455
|
361
|
-
def test_defaultstest_defaults
|
362
|
-
def test_returns_with_valuetest_returns_with_value
|
363
|
-
def test_returns_with_multiple_valuestest_returns_with_multiple_values
|
364
|
-
def
|
365
|
-
def
|
366
|
-
|
367
|
-
def
|
368
|
-
def
|
369
|
-
def
|
370
|
-
def
|
371
|
-
def
|
372
|
-
def
|
373
|
-
def
|
374
|
-
def
|
375
|
-
def
|
376
|
-
def
|
377
|
-
|
378
|
-
def
|
379
|
-
def
|
380
|
-
def
|
381
|
-
def
|
382
|
-
def
|
383
|
-
def
|
384
|
-
def
|
385
|
-
def
|
386
|
-
def
|
387
|
-
def
|
388
|
-
def
|
389
|
-
def
|
390
|
-
def
|
391
|
-
def
|
392
|
-
def
|
393
|
-
def
|
394
|
-
def
|
395
|
-
def
|
396
|
-
def
|
397
|
-
def
|
398
|
-
def
|
399
|
-
def
|
400
|
-
def
|
401
|
-
def
|
402
|
-
def
|
403
|
-
def
|
404
|
-
def
|
405
|
-
def
|
406
|
-
def
|
407
|
-
def
|
408
|
-
def
|
409
|
-
def
|
410
|
-
def
|
411
|
-
def
|
412
|
-
def
|
413
|
-
def
|
414
|
-
def
|
415
|
-
def
|
416
|
-
def
|
417
|
-
def
|
418
|
-
def
|
419
|
-
def
|
420
|
-
def
|
421
|
-
def
|
422
|
-
def
|
423
|
-
def
|
424
|
-
def
|
425
|
-
def
|
426
|
-
def
|
427
|
-
def
|
428
|
-
def
|
429
|
-
def
|
430
|
-
def
|
431
|
-
|
432
|
-
def
|
433
|
-
|
434
|
-
def
|
458
|
+
def test_defaultstest_defaults38,999
|
459
|
+
def test_returns_with_valuetest_returns_with_value47,1167
|
460
|
+
def test_returns_with_multiple_valuestest_returns_with_multiple_values55,1336
|
461
|
+
def test_multiple_returnstest_multiple_returns66,1596
|
462
|
+
def test_returns_with_blocktest_returns_with_block77,1856
|
463
|
+
def test_return_with_and_without_block_interleavedtest_return_with_and_without_block_interleaved86,2059
|
464
|
+
def test_and_returns_aliastest_and_returns_alias96,2339
|
465
|
+
def test_and_yield_will_continue_to_yield_the_same_valuetest_and_yield_will_continue_to_yield_the_same_value103,2476
|
466
|
+
def test_and_yield_with_multiple_values_yields_the_valuestest_and_yield_with_multiple_values_yields_the_values111,2722
|
467
|
+
def test_multiple_yields_are_done_sequentiallytest_multiple_yields_are_done_sequentially118,2932
|
468
|
+
def test_failure_if_no_block_giventest_failure_if_no_block_given127,3204
|
469
|
+
def test_failure_different_return_value_than_yield_returntest_failure_different_return_value_than_yield_return134,3387
|
470
|
+
def test_multiple_yieldstest_multiple_yields143,3673
|
471
|
+
def test_multiple_yields_will_yield_the_last_value_settest_multiple_yields_will_yield_the_last_value_set151,3911
|
472
|
+
def test_yielding_then_not_yielding_and_then_yielding_againtest_yielding_then_not_yielding_and_then_yielding_again162,4288
|
473
|
+
def test_yields_syntaxtest_yields_syntax173,4635
|
474
|
+
class MyError < RuntimeErrorMyError180,4780
|
475
|
+
def test_and_raises_with_exception_class_throws_exceptiontest_and_raises_with_exception_class_throws_exception183,4818
|
476
|
+
def test_and_raises_with_arguments_throws_exception_made_with_argstest_and_raises_with_arguments_throws_exception_made_with_args192,5027
|
477
|
+
def test_and_raises_with_a_specific_exception_throws_the_exceptiontest_and_raises_with_a_specific_exception_throws_the_exception202,5308
|
478
|
+
def test_raises_is_an_alias_for_and_raisetest_raises_is_an_alias_for_and_raise213,5578
|
479
|
+
def test_multiple_and_raise_clauses_will_be_done_sequentiallytest_multiple_and_raise_clauses_will_be_done_sequentially222,5783
|
480
|
+
def test_and_throw_will_throw_a_symboltest_and_throw_will_throw_a_symbol234,6181
|
481
|
+
def test_and_throw_with_expression_will_throwtest_and_throw_with_expression_will_throw245,6424
|
482
|
+
def test_throws_is_an_alias_for_and_throwtest_throws_is_an_alias_for_and_throw256,6706
|
483
|
+
def test_multiple_throws_will_be_done_sequentiallytest_multiple_throws_will_be_done_sequentially267,6981
|
484
|
+
def test_multiple_expectationstest_multiple_expectations279,7311
|
485
|
+
def test_with_no_args_with_no_argstest_with_no_args_with_no_args289,7548
|
486
|
+
def test_with_no_args_but_with_argstest_with_no_args_but_with_args296,7676
|
487
|
+
def test_with_any_argstest_with_any_args305,7875
|
488
|
+
def test_with_any_single_arg_matchingtest_with_any_single_arg_matching315,8053
|
489
|
+
def test_with_any_single_arg_nonmatchingtest_with_any_single_arg_nonmatching323,8246
|
490
|
+
def test_with_equal_arg_matchingtest_with_equal_arg_matching333,8481
|
491
|
+
def test_with_equal_arg_nonmatchingtest_with_equal_arg_nonmatching340,8644
|
492
|
+
def test_with_arbitrary_arg_matchingtest_with_arbitrary_arg_matching349,8881
|
493
|
+
def test_args_matching_with_regextest_args_matching_with_regex364,9301
|
494
|
+
def test_arg_matching_with_regex_matching_non_stringtest_arg_matching_with_regex_matching_non_string376,9628
|
495
|
+
def test_arg_matching_with_classtest_arg_matching_with_class383,9805
|
496
|
+
def test_arg_matching_with_no_matchtest_arg_matching_with_no_match394,10095
|
497
|
+
def test_arg_matching_with_string_doesnt_over_matchtest_arg_matching_with_string_doesnt_over_match403,10308
|
498
|
+
def test_block_arg_given_to_no_argstest_block_arg_given_to_no_args412,10527
|
499
|
+
def test_block_arg_given_to_matching_proctest_block_arg_given_to_matching_proc421,10731
|
500
|
+
def test_arg_matching_precedence_when_best_firsttest_arg_matching_precedence_when_best_first432,11016
|
501
|
+
def test_arg_matching_precedence_when_best_last_but_still_matches_firsttest_arg_matching_precedence_when_best_last_but_still_matches_first440,11225
|
502
|
+
def test_never_and_never_calledtest_never_and_never_called448,11457
|
503
|
+
def test_never_and_called_oncetest_never_and_called_once454,11572
|
504
|
+
def test_once_called_oncetest_once_called_once463,11768
|
505
|
+
def test_once_but_never_calledtest_once_but_never_called470,11902
|
506
|
+
def test_once_but_called_twicetest_once_but_called_twice478,12089
|
507
|
+
def test_twice_and_called_twicetest_twice_and_called_twice488,12308
|
508
|
+
def test_zero_or_more_called_zerotest_zero_or_more_called_zero496,12463
|
509
|
+
def test_zero_or_more_called_oncetest_zero_or_more_called_once502,12585
|
510
|
+
def test_zero_or_more_called_100test_zero_or_more_called_100509,12718
|
511
|
+
def test_timestest_times516,12864
|
512
|
+
def test_at_least_called_oncetest_at_least_called_once523,13005
|
513
|
+
def test_at_least_but_never_calledtest_at_least_but_never_called530,13152
|
514
|
+
def test_at_least_once_but_called_twicetest_at_least_once_but_called_twice538,13355
|
515
|
+
def test_at_least_and_exacttest_at_least_and_exact546,13526
|
516
|
+
def test_at_most_but_never_calledtest_at_most_but_never_called556,13756
|
517
|
+
def test_at_most_called_oncetest_at_most_called_once562,13892
|
518
|
+
def test_at_most_called_twicetest_at_most_called_twice569,14037
|
519
|
+
def test_at_most_and_at_least_called_nevertest_at_most_and_at_least_called_never579,14265
|
520
|
+
def test_at_most_and_at_least_called_oncetest_at_most_and_at_least_called_once587,14490
|
521
|
+
def test_at_most_and_at_least_called_twicetest_at_most_and_at_least_called_twice594,14663
|
522
|
+
def test_at_most_and_at_least_called_three_timestest_at_most_and_at_least_called_three_times602,14851
|
523
|
+
def test_call_counts_only_apply_to_matching_argstest_call_counts_only_apply_to_matching_args613,15129
|
524
|
+
def test_call_counts_only_apply_to_matching_args_with_mismatchtest_call_counts_only_apply_to_matching_args_with_mismatch625,15407
|
525
|
+
def test_ordered_calls_in_order_will_passtest_ordered_calls_in_order_will_pass641,15840
|
526
|
+
def test_ordered_calls_out_of_order_will_failtest_ordered_calls_out_of_order_will_fail651,16022
|
527
|
+
def test_order_calls_with_different_arg_lists_and_in_order_will_passtest_order_calls_with_different_arg_lists_and_in_order_will_pass663,16283
|
528
|
+
def test_order_calls_with_different_arg_lists_and_out_of_order_will_failtest_order_calls_with_different_arg_lists_and_out_of_order_will_fail673,16536
|
529
|
+
def test_unordered_calls_do_not_effect_ordered_testingtest_unordered_calls_do_not_effect_ordered_testing685,16862
|
530
|
+
def test_ordered_with_multiple_calls_will_passtest_ordered_with_multiple_calls_will_pass699,17132
|
531
|
+
def test_grouped_ordering_with_numberstest_grouped_ordering_with_numbers711,17347
|
532
|
+
def test_grouped_ordering_with_symbolstest_grouped_ordering_with_symbols726,17668
|
533
|
+
def test_explicit_ordering_mixed_with_implicit_ordering_should_not_overlaptest_explicit_ordering_mixed_with_implicit_ordering_should_not_overlap741,18030
|
534
|
+
def test_explicit_ordering_with_explicit_misorderstest_explicit_ordering_with_explicit_misorders751,18403
|
535
|
+
def test_ordering_with_explicit_no_args_matches_correctlytest_ordering_with_explicit_no_args_matches_correctly767,18934
|
536
|
+
def test_ordering_with_any_arg_matching_correctly_matchestest_ordering_with_any_arg_matching_correctly_matches779,19311
|
537
|
+
def test_ordering_between_mocks_is_not_normally_definedtest_ordering_between_mocks_is_not_normally_defined790,19623
|
538
|
+
def test_ordering_between_mocks_is_honored_for_global_orderingtest_ordering_between_mocks_is_honored_for_global_ordering802,19879
|
539
|
+
def test_expectation_formatingtest_expectation_formating814,20197
|
540
|
+
def test_multi_expectation_formattingtest_multi_expectation_formatting823,20425
|
541
|
+
def test_explicit_ordering_with_limits_allow_multiple_return_valuestest_explicit_ordering_with_limits_allow_multiple_return_values829,20588
|
542
|
+
def test_global_methods_can_be_mockedtest_global_methods_can_be_mocked848,21299
|
543
|
+
def test_kernel_methods_can_be_mockedtest_kernel_methods_can_be_mocked854,21483
|
544
|
+
def test_undefing_kernel_methods_dont_effect_other_mockstest_undefing_kernel_methods_dont_effect_other_mocks860,21661
|
545
|
+
class TestFlexMockShouldsWithInclude < Test::Unit::TestCaseTestFlexMockShouldsWithInclude870,21934
|
546
|
+
def test_include_enables_unqualified_arg_type_referencestest_include_enables_unqualified_arg_type_references872,22028
|
547
|
+
class TestFlexMockArgTypesDontLeak < Test::Unit::TestCaseTestFlexMockArgTypesDontLeak880,22192
|
548
|
+
def test_unqualified_arg_type_references_are_undefined_by_defaulttest_unqualified_arg_type_references_are_undefined_by_default881,22250
|
435
549
|
|
436
550
|
test/test_tu_integration.rb,1570
|
437
551
|
class TestTuIntegrationFlexMockMethod < Test::Unit::TestCaseTestTuIntegrationFlexMockMethod15,352
|