request_migrations 1.0.2 → 1.1.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 +15 -0
- data/lib/request_migrations/gem.rb +1 -1
- data/lib/request_migrations/testing.rb +24 -0
- data/lib/request_migrations.rb +12 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2224934d0be51149ebf90a756ae9cfd9172ee83310609c9cfc94c49c4c75166
|
4
|
+
data.tar.gz: 3de2f808de4c02d7de89ec9baae0b5d68cadab94d8118e13688a941de791d3cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 944f3e23fe55b3d9eb56cdf0491871bfecea72a5c9a57b15f8827152b7cf5a21ab0e0ac6c1f254a9afabe4fc980562b864e96a2868ec864a314d41876e1af987
|
7
|
+
data.tar.gz: e3fa22992ac3aadcd34ce860310f6a496f4aa7f54179090863bcf993582e2c757fa07677862973b817edc2d209b289284e19ec040249c62011ad20ceb41ee0c6
|
data/README.md
CHANGED
@@ -405,6 +405,21 @@ describe CombineNamesForUserMigration do
|
|
405
405
|
end
|
406
406
|
```
|
407
407
|
|
408
|
+
To avoid polluting the global configuration, you can use `RequestMigrations::Testing`
|
409
|
+
within your application's `spec/rails_helper.rb` (or similar).
|
410
|
+
|
411
|
+
```ruby
|
412
|
+
Rspec.configure do |config|
|
413
|
+
config.before :each do
|
414
|
+
RequestMigrations::Testing.setup!
|
415
|
+
end
|
416
|
+
|
417
|
+
config.after :each do
|
418
|
+
RequestMigrations::Testing.teardown!
|
419
|
+
end
|
420
|
+
end
|
421
|
+
```
|
422
|
+
|
408
423
|
## Tips and tricks
|
409
424
|
|
410
425
|
Over the years, we're learned a thing or two about versioning an API. We'll share tips here.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RequestMigrations
|
4
|
+
class Testing
|
5
|
+
@@config = RequestMigrations::Configuration.new
|
6
|
+
|
7
|
+
##
|
8
|
+
# setup! stores the original config and replaces it with a clone for testing.
|
9
|
+
def self.setup!
|
10
|
+
@@config = RequestMigrations.config
|
11
|
+
|
12
|
+
RequestMigrations.reset!
|
13
|
+
RequestMigrations.configure do |config|
|
14
|
+
@@config.config.each { |(k, v)| config.config[k] = v }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# teardown! restores the original config.
|
20
|
+
def self.teardown!
|
21
|
+
RequestMigrations.config = @@config
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/request_migrations.rb
CHANGED
@@ -43,6 +43,18 @@ module RequestMigrations
|
|
43
43
|
# config returns the current config.
|
44
44
|
def self.config = @config ||= Configuration.new
|
45
45
|
|
46
|
+
##
|
47
|
+
# @private
|
48
|
+
def self.config=(cfg)
|
49
|
+
@config = cfg
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# @private
|
54
|
+
def self.reset!
|
55
|
+
@config = RequestMigrations::Configuration.new
|
56
|
+
end
|
57
|
+
|
46
58
|
##
|
47
59
|
# logger returns the configured logger.
|
48
60
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: request_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zeke Gabrielse
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- lib/request_migrations/migrator.rb
|
75
75
|
- lib/request_migrations/railtie.rb
|
76
76
|
- lib/request_migrations/router.rb
|
77
|
+
- lib/request_migrations/testing.rb
|
77
78
|
- lib/request_migrations/version.rb
|
78
79
|
homepage: https://github.com/keygen-sh/request_migrations
|
79
80
|
licenses:
|