cross-stub 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/HISTORY.txt +12 -0
  2. data/README.rdoc +85 -29
  3. data/Rakefile +8 -1
  4. data/VERSION +1 -1
  5. data/cross-stub.gemspec +37 -19
  6. data/lib/cross-stub.rb +63 -24
  7. data/lib/cross-stub/arguments.rb +21 -0
  8. data/lib/cross-stub/arguments/array.rb +16 -0
  9. data/lib/cross-stub/arguments/hash.rb +17 -0
  10. data/lib/cross-stub/arguments/proc.rb +73 -0
  11. data/lib/cross-stub/cache.rb +36 -0
  12. data/lib/cross-stub/stores.rb +4 -0
  13. data/lib/cross-stub/stores/base.rb +38 -0
  14. data/lib/cross-stub/stores/file.rb +39 -0
  15. data/lib/cross-stub/stores/memcache.rb +40 -0
  16. data/lib/cross-stub/stores/redis.rb +41 -0
  17. data/lib/cross-stub/stubber.rb +132 -0
  18. data/rails_generators/cross_stub/cross_stub_generator.rb +1 -1
  19. data/rails_generators/cross_stub/templates/config/initializers/cross-stub.rb +9 -1
  20. data/rails_generators/cross_stub/templates/features/support/cross-stub.rb +16 -2
  21. data/spec/arguments/proc_spec.rb +689 -0
  22. data/spec/includes.rb +103 -0
  23. data/spec/integration/clearing_instance_stubs_spec.rb +119 -0
  24. data/spec/integration/clearing_stubs_spec.rb +118 -0
  25. data/spec/integration/creating_instance_stubs_spec.rb +91 -0
  26. data/spec/integration/creating_stubs_spec.rb +95 -0
  27. data/spec/integration/shared_spec.rb +35 -0
  28. data/spec/integration/stubbing_error_spec.rb +69 -0
  29. data/spec/service.rb +114 -0
  30. data/spec/spec_helper.rb +1 -41
  31. metadata +58 -26
  32. data/lib/cross-stub/cache_helpers.rb +0 -48
  33. data/lib/cross-stub/pseudo_class.rb +0 -82
  34. data/lib/cross-stub/setup_helpers.rb +0 -13
  35. data/lib/cross-stub/stub_helpers.rb +0 -64
  36. data/spec/cross-stub/clearing_stubs_spec.rb +0 -112
  37. data/spec/cross-stub/creating_stubs_spec.rb +0 -110
  38. data/spec/cross-stub/stubbing_error_spec.rb +0 -38
  39. data/spec/helpers.rb +0 -125
@@ -4,7 +4,7 @@ class CrossStubGenerator < Rails::Generator::Base
4
4
  record do |m|
5
5
  m.file 'config/initializers/cross-stub.rb', 'config/initializers/cross-stub.rb'
6
6
  m.file 'features/support/cross-stub.rb', 'features/support/cross-stub.rb'
7
- m.gsub_file 'config/environments/cucumber.rb', /\z/, "config.gem 'cross-stub', :version => '>=0.1.4'\n"
7
+ m.gsub_file 'config/environments/cucumber.rb', /\z/, "config.gem 'cross-stub', :version => '>=0.2.0'\n"
8
8
  end
9
9
  end
10
10
 
@@ -1,7 +1,15 @@
1
1
  if ENV['RAILS_ENV'] == 'cucumber'
2
2
  class ActionController::Dispatcher
3
3
  def refresh_stubs
4
- CrossStub.refresh :file => File.join(RAILS_ROOT, 'tmp', 'cross-stub.cache')
4
+ # /////////////////////////////////////////////////////////////////////////////////
5
+ # NOTE: By default, we use file-based cache store for cross-stub. Alternatively,
6
+ # u may wanna try out the other cache stores. Adding new cache store support is
7
+ # super easy, w.r.t actual implementation & testing, just drop me a note at
8
+ # http://github.com/ngty/cross-stub & i'll do it for u, of course FOC lah !!
9
+ # /////////////////////////////////////////////////////////////////////////////////
10
+ #CrossStub.refresh :redis => 'localhost:6379/xstub.cache' # requires *redis* gem
11
+ #CrossStub.refresh :memcache => 'localhost:11211/xstub.cache' # requires *memcache-client* gem
12
+ CrossStub.refresh :file => File.join(RAILS_ROOT, 'tmp', 'xstub.cache')
5
13
  end
6
14
  before_dispatch :refresh_stubs
7
15
  end
@@ -1,3 +1,17 @@
1
1
  require 'cross-stub'
2
- Before { CrossStub.setup :file => File.join(RAILS_ROOT, 'tmp', 'cross-stub.cache') }
3
- After { CrossStub.clear }
2
+
3
+ Before do
4
+ # /////////////////////////////////////////////////////////////////////////////////
5
+ # NOTE: By default, we use file-based cache store for cross-stub. Alternatively,
6
+ # u may wanna try out the other cache stores. Adding new cache store support is
7
+ # super easy, w.r.t actual implementation & testing, just drop me a note at
8
+ # http://github.com/ngty/cross-stub & i'll do it for u, of course FOC lah !!
9
+ # /////////////////////////////////////////////////////////////////////////////////
10
+ #CrossStub.setup :redis => 'localhost:6379/xstub.cache' # requires *redis* gem
11
+ #CrossStub.setup :memcache => 'localhost:11211/xstub.cache' # requires *memcache-client* gem
12
+ CrossStub.setup :file => File.join(RAILS_ROOT, 'tmp', 'xstub.cache')
13
+ end
14
+
15
+ After do
16
+ CrossStub.clear
17
+ end
@@ -0,0 +1,689 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
+
3
+ describe 'Extracting methods from proc' do
4
+
5
+ extract = CrossStub::Arguments::Proc.method(:parse)
6
+
7
+ describe '>> proc with single method (wo argument)' do
8
+
9
+ expected = {:bang => "def bang\n \"oops\"\nend"}
10
+
11
+ {
12
+ # ////////////////////////////////////////////////////////////////////////
13
+ # >> Always newlinling
14
+ # ////////////////////////////////////////////////////////////////////////
15
+ __LINE__ => (
16
+ lambda do
17
+ def bang
18
+ 'oops'
19
+ end
20
+ end
21
+ ),
22
+ __LINE__ => (
23
+ lambda {
24
+ def bang
25
+ 'oops'
26
+ end
27
+ }
28
+ ),
29
+ __LINE__ => (
30
+ proc do
31
+ def bang
32
+ 'oops'
33
+ end
34
+ end
35
+ ),
36
+ __LINE__ => (
37
+ proc {
38
+ def bang
39
+ 'oops'
40
+ end
41
+ }
42
+ ),
43
+ __LINE__ => (
44
+ Proc.new do
45
+ def bang
46
+ 'oops'
47
+ end
48
+ end
49
+ ),
50
+ __LINE__ => (
51
+ Proc.new {
52
+ def bang
53
+ 'oops'
54
+ end
55
+ }
56
+ ),
57
+ # ////////////////////////////////////////////////////////////////////////
58
+ # >> Partial newlining
59
+ # ////////////////////////////////////////////////////////////////////////
60
+ __LINE__ => (
61
+ lambda do
62
+ def bang ; 'oops' ; end
63
+ end
64
+ ),
65
+ __LINE__ => (
66
+ lambda {
67
+ def bang ; 'oops' ; end
68
+ }
69
+ ),
70
+ __LINE__ => (
71
+ proc do
72
+ def bang ; 'oops' ; end
73
+ end
74
+ ),
75
+ __LINE__ => (
76
+ proc {
77
+ def bang ; 'oops' ; end
78
+ }
79
+ ),
80
+ __LINE__ => (
81
+ Proc.new do
82
+ def bang ; 'oops' ; end
83
+ end
84
+ ),
85
+ __LINE__ => (
86
+ Proc.new {
87
+ def bang ; 'oops' ; end
88
+ }
89
+ ),
90
+ # ////////////////////////////////////////////////////////////////////////
91
+ # >> No newlining
92
+ # ////////////////////////////////////////////////////////////////////////
93
+ __LINE__ => (
94
+ lambda do def bang ; 'oops' ; end end
95
+ ),
96
+ __LINE__ => (
97
+ lambda { def bang ; 'oops' ; end }
98
+ ),
99
+ __LINE__ => (
100
+ proc do def bang ; 'oops' ; end end
101
+ ),
102
+ __LINE__ => (
103
+ proc { def bang ; 'oops' ; end }
104
+ ),
105
+ __LINE__ => (
106
+ Proc.new do def bang ; 'oops' ; end end
107
+ ),
108
+ __LINE__ => (
109
+ Proc.new { def bang ; 'oops' ; end }
110
+ ),
111
+ }.each do |debug, block|
112
+ should "handle proc as variable [##{debug}]" do
113
+ extract.call(&block).should.equal(expected)
114
+ end
115
+ end
116
+
117
+ should "handle block using do ... end [##{__LINE__}]" do
118
+ extract.call do
119
+ def bang
120
+ 'oops'
121
+ end
122
+ end.should.equal(expected)
123
+ end
124
+
125
+ should "handle block using do ... end [##{__LINE__}]" do
126
+ extract.call do
127
+ def bang ; 'oops' ; end
128
+ end.should.equal(expected)
129
+ end
130
+
131
+ should "handle block using do ... end [##{__LINE__}]" do
132
+ extract.call do def bang ; 'oops' ; end ; end.should.equal(expected)
133
+ end
134
+
135
+ should "handle block using do ... end [##{__LINE__}]" do
136
+ extract.call do
137
+ def bang
138
+ 'oops'
139
+ end
140
+ end.should.equal(expected)
141
+ end
142
+
143
+ should "handle block using { ... } [##{__LINE__}]" do
144
+ extract.call {
145
+ def bang
146
+ 'oops'
147
+ end
148
+ }.should.equal(expected)
149
+ end
150
+
151
+ should "handle block using { ... } [##{__LINE__}]" do
152
+ extract.call {
153
+ def bang ; 'oops' ; end
154
+ }.should.equal(expected)
155
+ end
156
+
157
+ should "handle block using { ... } [##{__LINE__}]" do
158
+ extract.call { def bang ; 'oops' ; end }.should.equal(expected)
159
+ end
160
+
161
+ end
162
+
163
+ describe '>> proc with single method (w argument)' do
164
+
165
+ expected = {:shout => "def shout(wat)\n wat\nend"}
166
+
167
+ {
168
+ # ////////////////////////////////////////////////////////////////////////
169
+ # >> Always newlinling
170
+ # ////////////////////////////////////////////////////////////////////////
171
+ __LINE__ => (
172
+ lambda do
173
+ def shout(wat)
174
+ wat
175
+ end
176
+ end
177
+ ),
178
+ __LINE__ => (
179
+ lambda {
180
+ def shout(wat)
181
+ wat
182
+ end
183
+ }
184
+ ),
185
+ __LINE__ => (
186
+ proc do
187
+ def shout(wat)
188
+ wat
189
+ end
190
+ end
191
+ ),
192
+ __LINE__ => (
193
+ proc {
194
+ def shout(wat)
195
+ wat
196
+ end
197
+ }
198
+ ),
199
+ __LINE__ => (
200
+ Proc.new do
201
+ def shout(wat)
202
+ wat
203
+ end
204
+ end
205
+ ),
206
+ __LINE__ => (
207
+ Proc.new {
208
+ def shout(wat)
209
+ wat
210
+ end
211
+ }
212
+ ),
213
+ # ////////////////////////////////////////////////////////////////////////
214
+ # >> Partial newlining
215
+ # ////////////////////////////////////////////////////////////////////////
216
+ __LINE__ => (
217
+ lambda do
218
+ def shout(wat) ; wat ; end
219
+ end
220
+ ),
221
+ __LINE__ => (
222
+ lambda {
223
+ def shout(wat) ; wat ; end
224
+ }
225
+ ),
226
+ __LINE__ => (
227
+ proc do
228
+ def shout(wat) ; wat ; end
229
+ end
230
+ ),
231
+ __LINE__ => (
232
+ proc {
233
+ def shout(wat) ; wat ; end
234
+ }
235
+ ),
236
+ __LINE__ => (
237
+ Proc.new do
238
+ def shout(wat) ; wat ; end
239
+ end
240
+ ),
241
+ __LINE__ => (
242
+ Proc.new {
243
+ def shout(wat) ; wat ; end
244
+ }
245
+ ),
246
+ # ////////////////////////////////////////////////////////////////////////
247
+ # >> No newlining
248
+ # ////////////////////////////////////////////////////////////////////////
249
+ __LINE__ => (
250
+ lambda do def shout(wat) ; wat ; end end
251
+ ),
252
+ __LINE__ => (
253
+ lambda { def shout(wat) ; wat ; end }
254
+ ),
255
+ __LINE__ => (
256
+ proc do def shout(wat) ; wat ; end end
257
+ ),
258
+ __LINE__ => (
259
+ proc { def shout(wat) ; wat ; end }
260
+ ),
261
+ __LINE__ => (
262
+ Proc.new do def shout(wat) ; wat ; end end
263
+ ),
264
+ __LINE__ => (
265
+ Proc.new { def shout(wat) ; wat ; end }
266
+ ),
267
+ }.each do |debug, block|
268
+ should "handle proc as variable [##{debug}]" do
269
+ extract.call(&block).should.equal(expected)
270
+ end
271
+ end
272
+
273
+ should "handle block using do ... end [##{__LINE__}]" do
274
+ extract.call do
275
+ def shout(wat)
276
+ wat
277
+ end
278
+ end.should.equal(expected)
279
+ end
280
+
281
+ should "handle block using do ... end [##{__LINE__}]" do
282
+ extract.call do
283
+ def shout(wat) ; wat ; end
284
+ end.should.equal(expected)
285
+ end
286
+
287
+ should "handle block using do ... end [##{__LINE__}]" do
288
+ extract.call do def shout(wat) ; wat ; end end.should.equal(expected)
289
+ end
290
+
291
+ should "handle block using do ... end [##{__LINE__}]" do
292
+ extract.call do
293
+ def shout(wat)
294
+ wat
295
+ end
296
+ end.should.equal(expected)
297
+ end
298
+
299
+ should "handle block using { ... } [##{__LINE__}]" do
300
+ extract.call {
301
+ def shout(wat)
302
+ wat
303
+ end
304
+ }.should.equal(expected)
305
+ end
306
+
307
+ should "handle block using { ... } [##{__LINE__}]" do
308
+ extract.call {
309
+ def shout(wat) ; wat ; end
310
+ }.should.equal(expected)
311
+ end
312
+
313
+ should "handle block using { ... } [##{__LINE__}]" do
314
+ extract.call { def shout(wat) ; wat ; end }.should.equal(expected)
315
+ end
316
+
317
+ end
318
+
319
+ describe '>> proc with multiple methods (wo argument)' do
320
+
321
+ expected = {
322
+ :bang => "def bang\n \"oops\"\nend",
323
+ :shout => "def shout\n \"hello\"\nend"
324
+ }
325
+
326
+ {
327
+ # ////////////////////////////////////////////////////////////////////////
328
+ # >> Always newlinling
329
+ # ////////////////////////////////////////////////////////////////////////
330
+ __LINE__ => (
331
+ lambda do
332
+ def bang
333
+ 'oops'
334
+ end
335
+ def shout
336
+ 'hello'
337
+ end
338
+ end
339
+ ),
340
+ __LINE__ => (
341
+ lambda {
342
+ def bang
343
+ 'oops'
344
+ end
345
+ def shout
346
+ 'hello'
347
+ end
348
+ }
349
+ ),
350
+ __LINE__ => (
351
+ proc do
352
+ def bang
353
+ 'oops'
354
+ end
355
+ def shout
356
+ 'hello'
357
+ end
358
+ end
359
+ ),
360
+ __LINE__ => (
361
+ proc {
362
+ def bang
363
+ 'oops'
364
+ end
365
+ def shout
366
+ 'hello'
367
+ end
368
+ }
369
+ ),
370
+ __LINE__ => (
371
+ Proc.new do
372
+ def bang
373
+ 'oops'
374
+ end
375
+ def shout
376
+ 'hello'
377
+ end
378
+ end
379
+ ),
380
+ __LINE__ => (
381
+ Proc.new {
382
+ def bang
383
+ 'oops'
384
+ end
385
+ def shout
386
+ 'hello'
387
+ end
388
+ }
389
+ ),
390
+ # ////////////////////////////////////////////////////////////////////////
391
+ # >> Partial newlining
392
+ # ////////////////////////////////////////////////////////////////////////
393
+ __LINE__ => (
394
+ lambda do
395
+ def bang ; 'oops' ; end
396
+ def shout ; 'hello' ; end
397
+ end
398
+ ),
399
+ __LINE__ => (
400
+ lambda {
401
+ def bang ; 'oops' ; end
402
+ def shout ; 'hello' ; end
403
+ }
404
+ ),
405
+ __LINE__ => (
406
+ proc do
407
+ def bang ; 'oops' ; end
408
+ def shout ; 'hello' ; end
409
+ end
410
+ ),
411
+ __LINE__ => (
412
+ proc {
413
+ def bang ; 'oops' ; end
414
+ def shout ; 'hello' ; end
415
+ }
416
+ ),
417
+ __LINE__ => (
418
+ Proc.new do
419
+ def bang ; 'oops' ; end
420
+ def shout ; 'hello' ; end
421
+ end
422
+ ),
423
+ __LINE__ => (
424
+ Proc.new {
425
+ def bang ; 'oops' ; end
426
+ def shout ; 'hello' ; end
427
+ }
428
+ ),
429
+ # ////////////////////////////////////////////////////////////////////////
430
+ # >> No newlining
431
+ # ////////////////////////////////////////////////////////////////////////
432
+ __LINE__ => (
433
+ lambda do def bang ; 'oops' ; end ; def shout ; 'hello' ; end end
434
+ ),
435
+ __LINE__ => (
436
+ lambda { def bang ; 'oops' ; end ; def shout ; 'hello' ; end }
437
+ ),
438
+ __LINE__ => (
439
+ proc do def bang ; 'oops' ; end ; def shout ; 'hello' ; end end
440
+ ),
441
+ __LINE__ => (
442
+ proc { def bang ; 'oops' ; end ; def shout ; 'hello' ; end }
443
+ ),
444
+ __LINE__ => (
445
+ Proc.new do def bang ; 'oops' ; end ; def shout ; 'hello' ; end end
446
+ ),
447
+ __LINE__ => (
448
+ Proc.new { def bang ; 'oops' ; end ; def shout ; 'hello' ; end }
449
+ ),
450
+ }.each do |debug, block|
451
+ should "handle proc as variable [##{debug}]" do
452
+ extract.call(&block).should.equal(expected)
453
+ end
454
+ end
455
+
456
+ should "handle block using do ... end [##{__LINE__}]" do
457
+ extract.call do
458
+ def bang
459
+ 'oops'
460
+ end
461
+ def shout
462
+ 'hello'
463
+ end
464
+ end.should.equal(expected)
465
+ end
466
+
467
+ should "handle block using do ... end [##{__LINE__}]" do
468
+ extract.call do
469
+ def bang ; 'oops' ; end
470
+ def shout ; 'hello' ; end
471
+ end.should.equal(expected)
472
+ end
473
+
474
+ should "handle block using do ... end [##{__LINE__}]" do
475
+ extract.call do def bang ; 'oops' ; end ; def shout ; 'hello' ; end end.
476
+ should.equal(expected)
477
+ end
478
+
479
+ should "handle block using { ... } [##{__LINE__}]" do
480
+ extract.call {
481
+ def bang
482
+ 'oops'
483
+ end
484
+ def shout
485
+ 'hello'
486
+ end
487
+ }.should.equal(expected)
488
+ end
489
+
490
+ should "handle block using { ... } [##{__LINE__}]" do
491
+ extract.call {
492
+ def bang ; 'oops' ; end
493
+ def shout ; 'hello' ; end
494
+ }.should.equal(expected)
495
+ end
496
+
497
+ should "handle block using { ... } [##{__LINE__}]" do
498
+ extract.call { def bang ; 'oops' ; end ; def shout ; 'hello' ; end }.
499
+ should.equal(expected)
500
+ end
501
+
502
+ end
503
+
504
+ describe '>> proc with multiple methods (w argument)' do
505
+
506
+ expected = {
507
+ :bang => "def bang(wat)\n wat\nend",
508
+ :shout => "def shout(wat)\n wat\nend"
509
+ }
510
+
511
+ {
512
+ # ////////////////////////////////////////////////////////////////////////
513
+ # >> Always newlinling
514
+ # ////////////////////////////////////////////////////////////////////////
515
+ __LINE__ => (
516
+ lambda do
517
+ def bang(wat)
518
+ wat
519
+ end
520
+ def shout(wat)
521
+ wat
522
+ end
523
+ end
524
+ ),
525
+ __LINE__ => (
526
+ lambda {
527
+ def bang(wat)
528
+ wat
529
+ end
530
+ def shout(wat)
531
+ wat
532
+ end
533
+ }
534
+ ),
535
+ __LINE__ => (
536
+ proc do
537
+ def bang(wat)
538
+ wat
539
+ end
540
+ def shout(wat)
541
+ wat
542
+ end
543
+ end
544
+ ),
545
+ __LINE__ => (
546
+ proc {
547
+ def bang(wat)
548
+ wat
549
+ end
550
+ def shout(wat)
551
+ wat
552
+ end
553
+ }
554
+ ),
555
+ __LINE__ => (
556
+ Proc.new do
557
+ def bang(wat)
558
+ wat
559
+ end
560
+ def shout(wat)
561
+ wat
562
+ end
563
+ end
564
+ ),
565
+ __LINE__ => (
566
+ Proc.new {
567
+ def bang(wat)
568
+ wat
569
+ end
570
+ def shout(wat)
571
+ wat
572
+ end
573
+ }
574
+ ),
575
+ # ////////////////////////////////////////////////////////////////////////
576
+ # >> Partial newlining
577
+ # ////////////////////////////////////////////////////////////////////////
578
+ __LINE__ => (
579
+ lambda do
580
+ def bang(wat) ; wat ; end
581
+ def shout(wat) ; wat ; end
582
+ end
583
+ ),
584
+ __LINE__ => (
585
+ lambda {
586
+ def bang(wat) ; wat ; end
587
+ def shout(wat) ; wat ; end
588
+ }
589
+ ),
590
+ __LINE__ => (
591
+ proc do
592
+ def bang(wat) ; wat ; end
593
+ def shout(wat) ; wat ; end
594
+ end
595
+ ),
596
+ __LINE__ => (
597
+ proc {
598
+ def bang(wat) ; wat ; end
599
+ def shout(wat) ; wat ; end
600
+ }
601
+ ),
602
+ __LINE__ => (
603
+ Proc.new do
604
+ def bang(wat) ; wat ; end
605
+ def shout(wat) ; wat ; end
606
+ end
607
+ ),
608
+ __LINE__ => (
609
+ Proc.new {
610
+ def bang(wat) ; wat ; end
611
+ def shout(wat) ; wat ; end
612
+ }
613
+ ),
614
+ # ////////////////////////////////////////////////////////////////////////
615
+ # >> No newlining
616
+ # ////////////////////////////////////////////////////////////////////////
617
+ __LINE__ => (
618
+ lambda do def bang(wat) ; wat ; end ; def shout(wat) ; wat ; end end
619
+ ),
620
+ __LINE__ => (
621
+ lambda { def bang(wat) ; wat ; end ; def shout(wat) ; wat ; end }
622
+ ),
623
+ __LINE__ => (
624
+ proc do def bang(wat) ; wat ; end ; def shout(wat) ; wat ; end end
625
+ ),
626
+ __LINE__ => (
627
+ proc { def bang(wat) ; wat ; end ; def shout(wat) ; wat ; end }
628
+ ),
629
+ __LINE__ => (
630
+ Proc.new do def bang(wat) ; wat ; end ; def shout(wat) ; wat ; end end
631
+ ),
632
+ __LINE__ => (
633
+ Proc.new { def bang(wat) ; wat ; end ; def shout(wat) ; wat ; end }
634
+ ),
635
+ }.each do |debug, block|
636
+ should "handle proc as variable [##{debug}]" do
637
+ extract.call(&block).should.equal(expected)
638
+ end
639
+ end
640
+
641
+ should "handle block using do ... end [##{__LINE__}]" do
642
+ extract.call do
643
+ def bang(wat)
644
+ wat
645
+ end
646
+ def shout(wat)
647
+ wat
648
+ end
649
+ end.should.equal(expected)
650
+ end
651
+
652
+ should "handle block using do ... end [##{__LINE__}]" do
653
+ extract.call do
654
+ def bang(wat) ; wat ; end
655
+ def shout(wat) ; wat ; end
656
+ end.should.equal(expected)
657
+ end
658
+
659
+ should "handle block using do ... end [##{__LINE__}]" do
660
+ extract.call do def bang(wat) ; wat ; end ; def shout(wat) ; wat ; end end.
661
+ should.equal(expected)
662
+ end
663
+
664
+ should "handle block using { ... } [##{__LINE__}]" do
665
+ extract.call {
666
+ def bang(wat)
667
+ wat
668
+ end
669
+ def shout(wat)
670
+ wat
671
+ end
672
+ }.should.equal(expected)
673
+ end
674
+
675
+ should "handle block using { ... } [##{__LINE__}]" do
676
+ extract.call {
677
+ def bang(wat) ; wat ; end
678
+ def shout(wat) ; wat ; end
679
+ }.should.equal(expected)
680
+ end
681
+
682
+ should "handle block using { ... } [##{__LINE__}]" do
683
+ extract.call { def bang(wat) ; wat ; end ; def shout(wat) ; wat ; end }.
684
+ should.equal(expected)
685
+ end
686
+
687
+ end
688
+
689
+ end