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.
Files changed (2) hide show
  1. data/lib/sham.rb +10 -4
  2. metadata +1 -1
@@ -24,8 +24,8 @@ class Sham
24
24
  @@shams = {}
25
25
  end
26
26
 
27
- def self.reset
28
- @@shams.values.each(&:reset)
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
- @offset = 0
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notahat-machinist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Yandell