once-ler 0.1.3 → 0.1.4
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 +4 -4
- data/README.md +2 -1
- data/lib/onceler/recorder.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d070c6fcc9f43b0c3f46b28046a64bee1476a3f2e6369e386bf918ae8d5717b1
|
4
|
+
data.tar.gz: 7022f92a6f2d92a1e35cdf08362606b7b7dc4e446c070fe77dbf8bb503971aae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/onceler/recorder.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
11
|
+
date: 2018-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|