flipper-active_record 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flipper/adapters/active_record.rb +10 -2
- data/lib/flipper/version.rb +1 -1
- data/test/adapters/active_record_test.rb +20 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd3dce59dca2ef74cc5a2c7876d58c7092d2ec94
|
4
|
+
data.tar.gz: 9f184e7412b0551c620be74bcc472e0e7e9b6098
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64d270a7cb239c40e84753d1c9d8bd5af3c766802da9d86a50bcc3d0327494b7ce940592d4091accc24d833840c34415dbabc587fe5510f42b37e42027d46718
|
7
|
+
data.tar.gz: a3563a75c68506bf99222dfbab192eb8027eb245cae2808f3c70d311a722c0879f48c11260936b0d999f1a754047bf02089cd734817a3c2c5fe1491f026075e1
|
@@ -9,12 +9,20 @@ module Flipper
|
|
9
9
|
|
10
10
|
# Private: Do not use outside of this adapter.
|
11
11
|
class Feature < ::ActiveRecord::Base
|
12
|
-
self.table_name =
|
12
|
+
self.table_name = [
|
13
|
+
::ActiveRecord::Base.table_name_prefix,
|
14
|
+
"flipper_features",
|
15
|
+
::ActiveRecord::Base.table_name_suffix,
|
16
|
+
].join
|
13
17
|
end
|
14
18
|
|
15
19
|
# Private: Do not use outside of this adapter.
|
16
20
|
class Gate < ::ActiveRecord::Base
|
17
|
-
self.table_name =
|
21
|
+
self.table_name = [
|
22
|
+
::ActiveRecord::Base.table_name_prefix,
|
23
|
+
"flipper_gates",
|
24
|
+
::ActiveRecord::Base.table_name_suffix,
|
25
|
+
].join
|
18
26
|
end
|
19
27
|
|
20
28
|
# Public: The name of the adapter.
|
data/lib/flipper/version.rb
CHANGED
@@ -42,4 +42,24 @@ class ActiveRecordTest < MiniTest::Test
|
|
42
42
|
ActiveRecord::Base.connection.execute("DROP table IF EXISTS `flipper_features`")
|
43
43
|
ActiveRecord::Base.connection.execute("DROP table IF EXISTS `flipper_gates`")
|
44
44
|
end
|
45
|
+
|
46
|
+
def test_models_honor_table_name_prefixes_and_suffixes
|
47
|
+
ActiveRecord::Base.table_name_prefix = :foo_
|
48
|
+
ActiveRecord::Base.table_name_suffix = :_bar
|
49
|
+
|
50
|
+
Flipper::Adapters::ActiveRecord.send(:remove_const, :Feature)
|
51
|
+
Flipper::Adapters::ActiveRecord.send(:remove_const, :Gate)
|
52
|
+
load("flipper/adapters/active_record.rb")
|
53
|
+
|
54
|
+
assert_equal "foo_flipper_features_bar", Flipper::Adapters::ActiveRecord::Feature.table_name
|
55
|
+
assert_equal "foo_flipper_gates_bar", Flipper::Adapters::ActiveRecord::Gate.table_name
|
56
|
+
|
57
|
+
ensure
|
58
|
+
ActiveRecord::Base.table_name_prefix = ""
|
59
|
+
ActiveRecord::Base.table_name_suffix = ""
|
60
|
+
|
61
|
+
Flipper::Adapters::ActiveRecord.send(:remove_const, :Feature)
|
62
|
+
Flipper::Adapters::ActiveRecord.send(:remove_const, :Gate)
|
63
|
+
load("flipper/adapters/active_record.rb")
|
64
|
+
end
|
45
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flipper
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.15.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
86
|
rubyforge_project:
|
87
|
-
rubygems_version: 2.
|
87
|
+
rubygems_version: 2.4.5.4
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
90
|
summary: ActiveRecord adapter for Flipper
|