notahat-machinist 1.0.0 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sham.rb +10 -4
- metadata +1 -1
data/lib/sham.rb
CHANGED
@@ -24,8 +24,8 @@ class Sham
|
|
24
24
|
@@shams = {}
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.reset
|
28
|
-
@@shams.values.each(
|
27
|
+
def self.reset(scope = :before_all)
|
28
|
+
@@shams.values.each { |sham| sham.reset(scope) }
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.define(&block)
|
@@ -40,8 +40,14 @@ class Sham
|
|
40
40
|
generate_values(12)
|
41
41
|
end
|
42
42
|
|
43
|
-
def reset
|
44
|
-
|
43
|
+
def reset(scope)
|
44
|
+
if scope == :before_all
|
45
|
+
@offset, @before_offset = 0, nil
|
46
|
+
elsif @before_offset
|
47
|
+
@offset = @before_offset
|
48
|
+
else
|
49
|
+
@before_offset = @offset
|
50
|
+
end
|
45
51
|
end
|
46
52
|
|
47
53
|
def fetch_value
|