flux_capacitor 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/flux_capacitor/testing.rb +2 -2
- data/lib/flux_capacitor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50b20888f09b8a4d3fe988ee6a6beedc07e525e3
|
4
|
+
data.tar.gz: b1bd10b79c3a037693ab01adbd4b707b4baee2f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 158cbb65dd3e2fa37e69541fd17873b6c9f6915c97d1e8eb14af636d3ce09784600be1c833e2f8dc34f16b22975c682186ac2501161ec4e73e96380bb45d6c42
|
7
|
+
data.tar.gz: aee129ec752be611ad80837c8912582260d4d9a768dd0b89af0419f4942e6b12feb4baf9cd34fc9f607fdf7b0e76739474392601925eb59852e7d324acbde414
|
data/README.md
CHANGED
@@ -65,6 +65,20 @@ end
|
|
65
65
|
|
66
66
|
One note about using the string hashing method, new content could get the old feature for a while.
|
67
67
|
|
68
|
+
### Testing
|
69
|
+
|
70
|
+
In order to test your code while migrating from one form to the other you can replace `Flux::Capacitor` with `Flux::Truthy` or `Flux::Falsy` They both expose the same API as a regular Capacitor but they `travel_to?` method will always return `true` and `false` respectively.
|
71
|
+
|
72
|
+
When working with rails you can do something like this:
|
73
|
+
```ruby
|
74
|
+
start = DateTime.parse('2017/08/14 00:00:00-000')
|
75
|
+
end_point = DateTime.parse('2017/09/14')
|
76
|
+
oldest = MyModel.first.created_at
|
77
|
+
FEATURE_1_CAPACITOR = Rails.env.test? ? Flux::Falsy.new : Flux::Capacitor.new(start, end_point, oldest)
|
78
|
+
```
|
79
|
+
|
80
|
+
This will make it so for your tests everything will be treated as before.
|
81
|
+
|
68
82
|
## Development
|
69
83
|
|
70
84
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Flux
|
2
|
-
class
|
2
|
+
class Falsy < Capacitor
|
3
3
|
def initialize(*args)
|
4
4
|
@pivot = DateTime.now
|
5
5
|
@time_dilation = 2.0
|
@@ -10,7 +10,7 @@ module Flux
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
class
|
13
|
+
class Truthy < Capacitor
|
14
14
|
def initialize(*args)
|
15
15
|
@pivot = DateTime.now
|
16
16
|
@time_dilation = 2.0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flux_capacitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raphael Eidus
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: murmurhash3
|