rails_multitenant 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +18 -4
- data/CHANGELOG.md +4 -0
- data/lib/rails_multitenant/global_context_registry.rb +1 -2
- data/lib/rails_multitenant/version.rb +1 -1
- data/rails_multitenant.gemspec +3 -1
- data/spec/global_context_registry_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- metadata +6 -8
- data/spec/current_spec.rb.dis +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94a0e8e9b129d21e888c56a07658779a32b4a4a8
|
4
|
+
data.tar.gz: a6004fe24c2671ca3153cbff26b7215059033ae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f406387794a47eff446ba20ec4e8adac962adf50f393cc0946122d49d29de456ed3bb1adef6dd128228924a1aa8813c8ea2886883f301621c62c7848aadda2c5
|
7
|
+
data.tar.gz: fd621cc380a647a82ebd9e888bd0e7c0ed2e10d3206ade3bc82e7623e8adf8e7d265181dbea98193cbc6b18df6fd6963b503c9202c656c238296773c1d3cabe8
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.4.
|
1
|
+
2.4.3
|
data/.travis.yml
CHANGED
@@ -2,9 +2,23 @@ language: ruby
|
|
2
2
|
sudo: false
|
3
3
|
env:
|
4
4
|
- RAILS_VERSION="~> 4.1.16"
|
5
|
-
- RAILS_VERSION="~> 4.2.
|
6
|
-
- RAILS_VERSION="~> 5.0.
|
7
|
-
- RAILS_VERSION="~> 5.1.
|
5
|
+
- RAILS_VERSION="~> 4.2.10"
|
6
|
+
- RAILS_VERSION="~> 5.0.6"
|
7
|
+
- RAILS_VERSION="~> 5.1.4"
|
8
8
|
rvm:
|
9
|
-
- 2.
|
9
|
+
- 2.5.0
|
10
|
+
- 2.4.3
|
11
|
+
- 2.3.6
|
12
|
+
- 2.2.9
|
13
|
+
- 2.1.10
|
14
|
+
matrix:
|
15
|
+
exclude:
|
16
|
+
- rvm: 2.1.10
|
17
|
+
env: RAILS_VERSION="~> 5.0.6"
|
18
|
+
- rvm: 2.1.10
|
19
|
+
env: RAILS_VERSION="~> 5.1.4"
|
20
|
+
- rvm: 2.4.3
|
21
|
+
env: RAILS_VERSION="~> 4.1.16"
|
22
|
+
- rvm: 2.5.0
|
23
|
+
env: RAILS_VERSION="~> 4.1.16"
|
10
24
|
before_install: gem install bundler -v 1.15.2
|
data/CHANGELOG.md
CHANGED
@@ -171,7 +171,7 @@ module RailsMultitenant
|
|
171
171
|
# Duplicate the registry
|
172
172
|
def duplicate_registry
|
173
173
|
globals.each_with_object({}) do |(key, value), result|
|
174
|
-
result[key] = (value.nil? || value.is_a?(
|
174
|
+
result[key] = (value.nil? || value.is_a?(Integer)) ? value : value.dup
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
@@ -224,6 +224,5 @@ module RailsMultitenant
|
|
224
224
|
Thread.current[:global_context_registry] = value
|
225
225
|
value
|
226
226
|
end
|
227
|
-
|
228
227
|
end
|
229
228
|
end
|
data/rails_multitenant.gemspec
CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = Dir.glob('spec/**/*')
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
+
spec.required_ruby_version = '>= 2.1.0'
|
21
|
+
|
20
22
|
spec.add_development_dependency "bundler", "~> 1.10"
|
21
23
|
|
22
24
|
spec.add_dependency 'activerecord', ENV.fetch('RAILS_VERSION', ['>= 4.1', '< 5.2'])
|
@@ -26,6 +28,6 @@ Gem::Specification.new do |spec|
|
|
26
28
|
spec.add_development_dependency 'database_cleaner', '>= 1.2'
|
27
29
|
spec.add_development_dependency 'rake', '< 11.0'
|
28
30
|
spec.add_development_dependency 'rspec', '~> 2'
|
29
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
31
|
+
spec.add_development_dependency 'simplecov', '~> 0.15.1'
|
30
32
|
spec.add_development_dependency 'sqlite3'
|
31
33
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
require 'simplecov'
|
4
4
|
require 'coveralls'
|
5
5
|
|
6
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
7
7
|
SimpleCov::Formatter::HTMLFormatter,
|
8
8
|
Coveralls::SimpleCov::Formatter
|
9
|
-
]
|
9
|
+
])
|
10
10
|
SimpleCov.start do
|
11
11
|
add_filter 'spec'
|
12
12
|
end
|
@@ -51,4 +51,4 @@ RSpec.configure do |config|
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
puts "Testing with ActiveRecord #{ActiveRecord::VERSION::STRING}"
|
54
|
+
puts "Testing with Ruby #{RUBY_VERSION} and ActiveRecord #{ActiveRecord::VERSION::STRING}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_multitenant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Breault
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,14 +126,14 @@ dependencies:
|
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: 0.
|
129
|
+
version: 0.15.1
|
130
130
|
type: :development
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version: 0.
|
136
|
+
version: 0.15.1
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: sqlite3
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,7 +176,6 @@ files:
|
|
176
176
|
- lib/rails_multitenant/version.rb
|
177
177
|
- rails_multitenant.gemspec
|
178
178
|
- spec/be_multitenant_on_matcher_spec.rb
|
179
|
-
- spec/current_spec.rb.dis
|
180
179
|
- spec/db/database.yml
|
181
180
|
- spec/db/schema.rb
|
182
181
|
- spec/external_item_spec.rb
|
@@ -199,7 +198,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
198
|
requirements:
|
200
199
|
- - ">="
|
201
200
|
- !ruby/object:Gem::Version
|
202
|
-
version:
|
201
|
+
version: 2.1.0
|
203
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
203
|
requirements:
|
205
204
|
- - ">="
|
@@ -207,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
206
|
version: '0'
|
208
207
|
requirements: []
|
209
208
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.6.
|
209
|
+
rubygems_version: 2.6.14
|
211
210
|
signing_key:
|
212
211
|
specification_version: 4
|
213
212
|
summary: Automatically configures multiple tenants in a Rails environment
|
@@ -216,7 +215,6 @@ test_files:
|
|
216
215
|
- spec/global_context_registry_spec.rb
|
217
216
|
- spec/external_item_spec.rb
|
218
217
|
- spec/item_subtype_spec.rb
|
219
|
-
- spec/current_spec.rb.dis
|
220
218
|
- spec/item_spec.rb
|
221
219
|
- spec/external_item_with_optional_org_spec.rb
|
222
220
|
- spec/db/schema.rb
|
data/spec/current_spec.rb.dis
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
# Create multiple orgs
|
2
|
-
# Create an item in each
|
3
|
-
# Make sure you can only see one org's item in one org
|
4
|
-
|
5
|
-
describe RailsMultitenant::GlobalContextRegistry::Current do
|
6
|
-
|
7
|
-
class Parent
|
8
|
-
include RailsMultitenant::GlobalContextRegistry::Current
|
9
|
-
|
10
|
-
attr_accessor :id
|
11
|
-
|
12
|
-
def initialize(id: 0)
|
13
|
-
@id = id
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class Dependent
|
18
|
-
include RailsMultitenant::GlobalContextRegistry::Current
|
19
|
-
global_context_dependent_on Parent
|
20
|
-
end
|
21
|
-
|
22
|
-
class StepParent < Parent
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'current' do
|
26
|
-
expect(Parent.current.id).to eq(0)
|
27
|
-
expect(Parent.current).to eq(Parent.current)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'current=' do
|
31
|
-
Parent.current = Parent.new(id: 42)
|
32
|
-
expect(Parent.current.id).to eq(42)
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
it 'clear_current!' do
|
37
|
-
Parent.clear_current!
|
38
|
-
expect(Parent.current.id).to eq(0)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'current?' do
|
42
|
-
Parent.clear_current!
|
43
|
-
expect(Parent.current?).to be_falsey
|
44
|
-
Parent.current = Parent.new(id: 42)
|
45
|
-
expect(Parent.current?).to be_truthy
|
46
|
-
end
|
47
|
-
|
48
|
-
context 'with dependencies' do
|
49
|
-
it 'dependent is cleared' do
|
50
|
-
Parent.current = Parent.new(id: 78)
|
51
|
-
Dependent.current = Dependent.new
|
52
|
-
Parent.current = Parent.new(id: 78)
|
53
|
-
expect(Dependent.current?).to be_falsey
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'dependent subclass is cleared' do
|
57
|
-
Parent.current = Parent.new(id: 78)
|
58
|
-
Dependent.current = Dependent.new
|
59
|
-
Parent.current = StepParent.new(id: 78)
|
60
|
-
expect(Dependent.current?).to be_falsey
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
#let(dependent_id) { Organization.current.id }
|
65
|
-
|
66
|
-
it 'dependent model subclass is cleared' do
|
67
|
-
#Organization.current = Organization.create!
|
68
|
-
DependsOnOrganization.current = DependsOnOrganization.create!
|
69
|
-
dependent_id = DependsOnOrganization.current.object_id
|
70
|
-
SubOrganization.current = SubOrganization.create!
|
71
|
-
expect(DependsOnOrganization.current.object_id).not_to eq(dependent_id)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|