once-ler 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/onceler/recorder.rb +5 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbf5b269f941f3229b8458562f4e680a6fb7a252d5af905bd115d2057bc81989
4
- data.tar.gz: 125edea3d2ae36a6719bd91ad3e88bd026d158afa96dc2c52aef0aa0bba38797
3
+ metadata.gz: d070c6fcc9f43b0c3f46b28046a64bee1476a3f2e6369e386bf918ae8d5717b1
4
+ data.tar.gz: 7022f92a6f2d92a1e35cdf08362606b7b7dc4e446c070fe77dbf8bb503971aae
5
5
  SHA512:
6
- metadata.gz: 5e874374de2828630f69386fda4ff877e68f944825e703a50cea1fda0d709d25a10b3f5506e356cc0f9ecdbf95176b86d57574ae7025fa426125d1f08aab41c4
7
- data.tar.gz: fe5d063d27a141f6e43a7ca2992d282ee4480e8f9822d1713166a217f413272ab8b2ba98426508e8eaa6a1b07659acaf3976591a517622beba9eaca9108540ea
6
+ metadata.gz: 01c8cc6c6a2964809cc65a8dfde2c35ca8a8fbfc3e777552e689e544bfe31aa3d5011fcb779de1f358186ad5c73d3ffbef53ad4a2f8128d3ac36a6ed3323cc60
7
+ data.tar.gz: 7f6568a41e20f9c41d24fb2abca6297db5d5b7a0ddc2255bcfd75091535d2c6640742c8e78d7d8a73e5fd3f14418e82bb87a25ca382b6a86574b822decc43a45
data/README.md CHANGED
@@ -46,7 +46,8 @@ Use this.
46
46
  Shorthand for around(:once) + around(:each). Be careful, as you cannot
47
47
  share state with instance variables between arounds and examples, so
48
48
  use local variables if you want to say freeze time consistently
49
- between all before(*) and examples.
49
+ between all before(*) and examples. Also, the block is called twice (once for
50
+ :once and once for :each), so be careful using, e.g. Time.now in the block.
50
51
 
51
52
  ## Ambitious usage
52
53
 
@@ -55,6 +55,10 @@ module Onceler
55
55
  @arounds.unshift(block)
56
56
  end
57
57
 
58
+ def arounds
59
+ (parent ? parent.arounds : []) + @arounds
60
+ end
61
+
58
62
  def record!
59
63
  Onceler.recording = true
60
64
  begin_transactions!
@@ -76,7 +80,7 @@ module Onceler
76
80
  end
77
81
  end
78
82
  # and then stack each around block on top
79
- @arounds.inject(stack) do |old_stack, hook|
83
+ arounds.inject(stack) do |old_stack, hook|
80
84
  -> { @tape.instance_exec(old_stack, &hook) }
81
85
  end.call
82
86
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: once-ler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-30 00:00:00.000000000 Z
11
+ date: 2018-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord