shoulda-context 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shoulda/context/context.rb +32 -5
- data/lib/shoulda/context/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 880fce4e56a3fc781a60b71e5fa369c741d94298
|
4
|
+
data.tar.gz: 4a3d36599636a422e721c193c0b7e8ae664f626f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cf7bd670f4ecc502e374375ed072780e11b73a6622a4a8d48d288992e009623edf16233a84515062f181a982089a522fb29aee48ef3170682ac55a4fe80bd0e
|
7
|
+
data.tar.gz: ca5a33a636d9be10037ddc7aaafba1c7e639a0d2cb00efc7e8e2dfcae5f4a99706e90f8424f8fc0f818856c09d92dc30c93c199fc5edfc6a02d1e60e11a2c28b
|
@@ -318,7 +318,12 @@ module Shoulda
|
|
318
318
|
end
|
319
319
|
|
320
320
|
def merge_block(&blk)
|
321
|
-
|
321
|
+
if self.respond_to?(:instance_exec)
|
322
|
+
self.instance_exec(&blk)
|
323
|
+
else
|
324
|
+
# deprecated in Rails 4.x
|
325
|
+
blk.bind(self).call
|
326
|
+
end
|
322
327
|
end
|
323
328
|
|
324
329
|
def context(name, &blk)
|
@@ -395,9 +400,21 @@ module Shoulda
|
|
395
400
|
@shoulda_context = context
|
396
401
|
begin
|
397
402
|
context.run_parent_setup_blocks(self)
|
398
|
-
|
403
|
+
if should[:before]
|
404
|
+
if self.respond_to?(:instance_exec)
|
405
|
+
self.instance_exec(&should[:before])
|
406
|
+
else
|
407
|
+
# deprecated in Rails 4.x
|
408
|
+
should[:before].bind(self).call
|
409
|
+
end
|
410
|
+
end
|
399
411
|
context.run_current_setup_blocks(self)
|
400
|
-
|
412
|
+
if self.respond_to?(:instance_exec)
|
413
|
+
self.instance_exec(&should[:block])
|
414
|
+
else
|
415
|
+
# deprecated in Rails 4.x
|
416
|
+
should[:block].bind(self).call
|
417
|
+
end
|
401
418
|
ensure
|
402
419
|
context.run_all_teardown_blocks(self)
|
403
420
|
end
|
@@ -415,13 +432,23 @@ module Shoulda
|
|
415
432
|
|
416
433
|
def run_current_setup_blocks(binding)
|
417
434
|
setup_blocks.each do |setup_block|
|
418
|
-
|
435
|
+
if binding.respond_to?(:instance_exec)
|
436
|
+
binding.instance_exec(&setup_block)
|
437
|
+
else
|
438
|
+
# deprecated in Rails 4.x
|
439
|
+
setup_block.bind(binding).call
|
440
|
+
end
|
419
441
|
end
|
420
442
|
end
|
421
443
|
|
422
444
|
def run_all_teardown_blocks(binding)
|
423
445
|
teardown_blocks.reverse.each do |teardown_block|
|
424
|
-
|
446
|
+
if binding.respond_to?(:instance_exec)
|
447
|
+
binding.instance_exec(&teardown_block)
|
448
|
+
else
|
449
|
+
# deprecated in Rails 4.x
|
450
|
+
teardown_block.bind(binding).call
|
451
|
+
end
|
425
452
|
end
|
426
453
|
self.parent.run_all_teardown_blocks(binding) if am_subcontext?
|
427
454
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoulda-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot, inc.
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-
|
16
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: appraisal
|