shoulda-context 1.1.5 → 1.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9babaf5d9e91c606e7ea6a929319843ab7b0cae4
4
- data.tar.gz: a28a2da8ad2ac965197e64525ce1f99a6cbc3e26
3
+ metadata.gz: 880fce4e56a3fc781a60b71e5fa369c741d94298
4
+ data.tar.gz: 4a3d36599636a422e721c193c0b7e8ae664f626f
5
5
  SHA512:
6
- metadata.gz: cf1d4bb465fef15c839c4e422b82ed53640bc2ac7a50d565731078d43f7f68e93f73e1c7f54ec14e52eb9a2b0a4cf2070f39b477faeb5af7878a0d5bdd235959
7
- data.tar.gz: 0669d46b4968e00c933879e91ae90f067569ad38ad210550498ab54a1d82319e9e1b63618b286d2020a6a4fc970c1af908bcbce3ca850cca8d7509daeeb9bc6e
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
- blk.bind(self).call
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
- should[:before].bind(self).call if should[:before]
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
- should[:block].bind(self).call
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
- setup_block.bind(binding).call
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
- teardown_block.bind(binding).call
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
@@ -1,5 +1,5 @@
1
1
  module Shoulda
2
2
  module Context
3
- VERSION = '1.1.5'.freeze
3
+ VERSION = '1.1.6'.freeze
4
4
  end
5
5
  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.5
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-08-14 00:00:00.000000000 Z
16
+ date: 2013-11-04 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: appraisal