once-ler 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/onceler/basic_helpers.rb +6 -6
- data/lib/onceler/recorder.rb +1 -1
- metadata +2 -2
@@ -16,6 +16,7 @@ module Onceler
|
|
16
16
|
raise ArgumentError, "wrong number of arguments (0 for 1)" if name.nil?
|
17
17
|
raise "#let or #subject called without a block" if block.nil?
|
18
18
|
onceler(:create)[name] = block
|
19
|
+
add_onceler_hooks!
|
19
20
|
@current_let_once = name
|
20
21
|
define_method(name) { onceler[name] }
|
21
22
|
end
|
@@ -29,6 +30,7 @@ module Onceler
|
|
29
30
|
|
30
31
|
def before_once(&block)
|
31
32
|
onceler(:create) << block
|
33
|
+
add_onceler_hooks!
|
32
34
|
end
|
33
35
|
|
34
36
|
def once_scopes
|
@@ -82,17 +84,12 @@ module Onceler
|
|
82
84
|
|
83
85
|
def onceler(create_own = false)
|
84
86
|
if create_own
|
85
|
-
@onceler ||=
|
87
|
+
@onceler ||= Recorder.new(self)
|
86
88
|
else
|
87
89
|
@onceler || parent_onceler
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
91
|
-
def create_onceler!
|
92
|
-
add_onceler_hooks!
|
93
|
-
Recorder.new(self)
|
94
|
-
end
|
95
|
-
|
96
93
|
def parent_onceler
|
97
94
|
return unless superclass.respond_to?(:onceler)
|
98
95
|
superclass.onceler
|
@@ -116,6 +113,9 @@ module Onceler
|
|
116
113
|
private
|
117
114
|
|
118
115
|
def add_onceler_hooks!
|
116
|
+
return if @onceler_hooks_added
|
117
|
+
@onceler_hooks_added = true
|
118
|
+
|
119
119
|
before(:all) do |group|
|
120
120
|
group.onceler.record!
|
121
121
|
end
|
data/lib/onceler/recorder.rb
CHANGED
@@ -103,7 +103,7 @@ module Onceler
|
|
103
103
|
context ? context.instance_eval(&hook) : hook.call
|
104
104
|
end
|
105
105
|
if parent
|
106
|
-
parent.
|
106
|
+
parent.run_after_hooks(scope, context)
|
107
107
|
else
|
108
108
|
Onceler.configuration.run_hooks(:after, scope, context)
|
109
109
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: once-ler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|