ros-apartment 2.3.0.alpha2 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/.rubocop-linter.yml +22 -0
  3. data/.pryrc +5 -3
  4. data/.rubocop.yml +21 -0
  5. data/.rubocop_todo.yml +29 -0
  6. data/.story_branch.yml +4 -0
  7. data/.travis.yml +15 -36
  8. data/Appraisals +16 -29
  9. data/Gemfile +4 -1
  10. data/Guardfile +3 -1
  11. data/HISTORY.md +7 -0
  12. data/README.md +80 -39
  13. data/Rakefile +45 -23
  14. data/apartment.gemspec +33 -25
  15. data/gemfiles/rails_4_2.gemfile +12 -10
  16. data/gemfiles/rails_5_0.gemfile +2 -1
  17. data/gemfiles/rails_5_1.gemfile +2 -1
  18. data/gemfiles/rails_5_2.gemfile +2 -1
  19. data/gemfiles/rails_6_0.gemfile +6 -5
  20. data/gemfiles/rails_master.gemfile +2 -1
  21. data/lib/apartment.rb +36 -11
  22. data/lib/apartment/active_record/connection_handling.rb +17 -0
  23. data/lib/apartment/active_record/internal_metadata.rb +11 -0
  24. data/lib/apartment/active_record/schema_migration.rb +13 -0
  25. data/lib/apartment/adapters/abstract_adapter.rb +50 -45
  26. data/lib/apartment/adapters/abstract_jdbc_adapter.rb +4 -3
  27. data/lib/apartment/adapters/jdbc_mysql_adapter.rb +3 -3
  28. data/lib/apartment/adapters/jdbc_postgresql_adapter.rb +20 -13
  29. data/lib/apartment/adapters/mysql2_adapter.rb +10 -9
  30. data/lib/apartment/adapters/postgis_adapter.rb +3 -2
  31. data/lib/apartment/adapters/postgresql_adapter.rb +55 -27
  32. data/lib/apartment/adapters/sqlite3_adapter.rb +18 -8
  33. data/lib/apartment/console.rb +35 -3
  34. data/lib/apartment/custom_console.rb +42 -0
  35. data/lib/apartment/deprecation.rb +2 -1
  36. data/lib/apartment/elevators/domain.rb +4 -3
  37. data/lib/apartment/elevators/first_subdomain.rb +3 -2
  38. data/lib/apartment/elevators/generic.rb +4 -3
  39. data/lib/apartment/elevators/host.rb +6 -1
  40. data/lib/apartment/elevators/host_hash.rb +6 -2
  41. data/lib/apartment/elevators/subdomain.rb +9 -5
  42. data/lib/apartment/migrator.rb +4 -3
  43. data/lib/apartment/model.rb +27 -0
  44. data/lib/apartment/railtie.rb +26 -15
  45. data/lib/apartment/reloader.rb +2 -1
  46. data/lib/apartment/tasks/enhancements.rb +4 -6
  47. data/lib/apartment/tenant.rb +19 -9
  48. data/lib/apartment/version.rb +3 -1
  49. data/lib/generators/apartment/install/install_generator.rb +4 -3
  50. data/lib/generators/apartment/install/templates/apartment.rb +3 -2
  51. data/lib/tasks/apartment.rake +24 -19
  52. metadata +79 -256
  53. data/spec/adapters/jdbc_mysql_adapter_spec.rb +0 -19
  54. data/spec/adapters/jdbc_postgresql_adapter_spec.rb +0 -41
  55. data/spec/adapters/mysql2_adapter_spec.rb +0 -59
  56. data/spec/adapters/postgresql_adapter_spec.rb +0 -61
  57. data/spec/adapters/sqlite3_adapter_spec.rb +0 -83
  58. data/spec/apartment_spec.rb +0 -11
  59. data/spec/config/database.yml.sample +0 -49
  60. data/spec/dummy/Rakefile +0 -7
  61. data/spec/dummy/app/controllers/application_controller.rb +0 -6
  62. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  63. data/spec/dummy/app/models/company.rb +0 -3
  64. data/spec/dummy/app/models/user.rb +0 -3
  65. data/spec/dummy/app/views/application/index.html.erb +0 -1
  66. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  67. data/spec/dummy/config.ru +0 -4
  68. data/spec/dummy/config/application.rb +0 -49
  69. data/spec/dummy/config/boot.rb +0 -11
  70. data/spec/dummy/config/database.yml.sample +0 -44
  71. data/spec/dummy/config/environment.rb +0 -5
  72. data/spec/dummy/config/environments/development.rb +0 -28
  73. data/spec/dummy/config/environments/production.rb +0 -51
  74. data/spec/dummy/config/environments/test.rb +0 -34
  75. data/spec/dummy/config/initializers/apartment.rb +0 -4
  76. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  77. data/spec/dummy/config/initializers/inflections.rb +0 -10
  78. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  79. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  80. data/spec/dummy/config/initializers/session_store.rb +0 -8
  81. data/spec/dummy/config/locales/en.yml +0 -5
  82. data/spec/dummy/config/routes.rb +0 -3
  83. data/spec/dummy/db/migrate/20110613152810_create_dummy_models.rb +0 -39
  84. data/spec/dummy/db/migrate/20111202022214_create_table_books.rb +0 -14
  85. data/spec/dummy/db/migrate/20180415260934_create_public_tokens.rb +0 -13
  86. data/spec/dummy/db/schema.rb +0 -55
  87. data/spec/dummy/db/seeds.rb +0 -5
  88. data/spec/dummy/db/seeds/import.rb +0 -5
  89. data/spec/dummy/public/404.html +0 -26
  90. data/spec/dummy/public/422.html +0 -26
  91. data/spec/dummy/public/500.html +0 -26
  92. data/spec/dummy/public/favicon.ico +0 -0
  93. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  94. data/spec/dummy/script/rails +0 -6
  95. data/spec/dummy_engine/.gitignore +0 -8
  96. data/spec/dummy_engine/Gemfile +0 -15
  97. data/spec/dummy_engine/Rakefile +0 -34
  98. data/spec/dummy_engine/bin/rails +0 -12
  99. data/spec/dummy_engine/config/initializers/apartment.rb +0 -51
  100. data/spec/dummy_engine/dummy_engine.gemspec +0 -24
  101. data/spec/dummy_engine/lib/dummy_engine.rb +0 -4
  102. data/spec/dummy_engine/lib/dummy_engine/engine.rb +0 -4
  103. data/spec/dummy_engine/lib/dummy_engine/version.rb +0 -3
  104. data/spec/dummy_engine/test/dummy/Rakefile +0 -6
  105. data/spec/dummy_engine/test/dummy/config.ru +0 -4
  106. data/spec/dummy_engine/test/dummy/config/application.rb +0 -22
  107. data/spec/dummy_engine/test/dummy/config/boot.rb +0 -5
  108. data/spec/dummy_engine/test/dummy/config/database.yml +0 -25
  109. data/spec/dummy_engine/test/dummy/config/environment.rb +0 -5
  110. data/spec/dummy_engine/test/dummy/config/environments/development.rb +0 -37
  111. data/spec/dummy_engine/test/dummy/config/environments/production.rb +0 -78
  112. data/spec/dummy_engine/test/dummy/config/environments/test.rb +0 -39
  113. data/spec/dummy_engine/test/dummy/config/initializers/assets.rb +0 -8
  114. data/spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  115. data/spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  116. data/spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  117. data/spec/dummy_engine/test/dummy/config/initializers/inflections.rb +0 -16
  118. data/spec/dummy_engine/test/dummy/config/initializers/mime_types.rb +0 -4
  119. data/spec/dummy_engine/test/dummy/config/initializers/session_store.rb +0 -3
  120. data/spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  121. data/spec/dummy_engine/test/dummy/config/locales/en.yml +0 -23
  122. data/spec/dummy_engine/test/dummy/config/routes.rb +0 -56
  123. data/spec/dummy_engine/test/dummy/config/secrets.yml +0 -22
  124. data/spec/examples/connection_adapter_examples.rb +0 -42
  125. data/spec/examples/generic_adapter_custom_configuration_example.rb +0 -95
  126. data/spec/examples/generic_adapter_examples.rb +0 -163
  127. data/spec/examples/schema_adapter_examples.rb +0 -234
  128. data/spec/integration/apartment_rake_integration_spec.rb +0 -107
  129. data/spec/integration/query_caching_spec.rb +0 -81
  130. data/spec/integration/use_within_an_engine_spec.rb +0 -28
  131. data/spec/schemas/v1.rb +0 -16
  132. data/spec/schemas/v2.rb +0 -43
  133. data/spec/schemas/v3.rb +0 -49
  134. data/spec/spec_helper.rb +0 -61
  135. data/spec/support/apartment_helpers.rb +0 -43
  136. data/spec/support/capybara_sessions.rb +0 -15
  137. data/spec/support/config.rb +0 -10
  138. data/spec/support/contexts.rb +0 -52
  139. data/spec/support/requirements.rb +0 -35
  140. data/spec/support/setup.rb +0 -46
  141. data/spec/tasks/apartment_rake_spec.rb +0 -129
  142. data/spec/tenant_spec.rb +0 -190
  143. data/spec/unit/config_spec.rb +0 -112
  144. data/spec/unit/elevators/domain_spec.rb +0 -32
  145. data/spec/unit/elevators/first_subdomain_spec.rb +0 -24
  146. data/spec/unit/elevators/generic_spec.rb +0 -54
  147. data/spec/unit/elevators/host_hash_spec.rb +0 -32
  148. data/spec/unit/elevators/host_spec.rb +0 -89
  149. data/spec/unit/elevators/subdomain_spec.rb +0 -76
  150. data/spec/unit/migrator_spec.rb +0 -77
  151. data/spec/unit/reloader_spec.rb +0 -24
@@ -1,190 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Apartment::Tenant do
4
- context "using mysql", database: :mysql do
5
-
6
- before { subject.reload!(config) }
7
-
8
- describe "#adapter" do
9
- it "should load mysql adapter" do
10
- subject.adapter
11
- expect(Apartment::Adapters::Mysql2Adapter).to be_a(Class)
12
- end
13
- end
14
-
15
- # TODO this doesn't belong here, but there aren't integration tests currently for mysql
16
- # where to put???
17
- describe "exception recovery", :type => :request do
18
- before do
19
- subject.create db1
20
- end
21
- after{ subject.drop db1 }
22
-
23
- # it "should recover from incorrect database" do
24
- # session = Capybara::Session.new(:rack_test, Capybara.app)
25
- # session.visit("http://#{db1}.com")
26
- # expect {
27
- # session.visit("http://this-database-should-not-exist.com")
28
- # }.to raise_error
29
- # session.visit("http://#{db1}.com")
30
- # end
31
- end
32
-
33
- # TODO re-organize these tests
34
- context "with prefix and schemas" do
35
- describe "#create" do
36
- before do
37
- Apartment.configure do |config|
38
- config.prepend_environment = true
39
- config.use_schemas = true
40
- end
41
-
42
- subject.reload!(config)
43
- end
44
-
45
- after { subject.drop "db_with_prefix" rescue nil }
46
-
47
- it "should create a new database" do
48
- subject.create "db_with_prefix"
49
- end
50
- end
51
- end
52
- end
53
-
54
- context "using postgresql", database: :postgresql do
55
- before do
56
- Apartment.use_schemas = true
57
- subject.reload!(config)
58
- end
59
-
60
- describe "#adapter" do
61
- it "should load postgresql adapter" do
62
- expect(subject.adapter).to be_a(Apartment::Adapters::PostgresqlSchemaAdapter)
63
- end
64
-
65
- it "raises exception with invalid adapter specified" do
66
- subject.reload!(config.merge(adapter: 'unknown'))
67
-
68
- expect {
69
- Apartment::Tenant.adapter
70
- }.to raise_error(RuntimeError)
71
- end
72
-
73
- context "threadsafety" do
74
- before { subject.create db1 }
75
- after { subject.drop db1 }
76
-
77
- it 'has a threadsafe adapter' do
78
- subject.switch!(db1)
79
- thread = Thread.new { expect(subject.current).to eq(Apartment.default_tenant) }
80
- thread.join
81
- expect(subject.current).to eq(db1)
82
- end
83
- end
84
- end
85
-
86
- # TODO above spec are also with use_schemas=true
87
- context "with schemas" do
88
- before do
89
- Apartment.configure do |config|
90
- config.excluded_models = []
91
- config.use_schemas = true
92
- config.seed_after_create = true
93
- end
94
- subject.create db1
95
- end
96
-
97
- after{ subject.drop db1 }
98
-
99
- describe "#create" do
100
- it "should seed data" do
101
- subject.switch! db1
102
- expect(User.count).to be > 0
103
- end
104
- end
105
-
106
- describe "#switch!" do
107
-
108
- let(:x){ rand(3) }
109
-
110
- context "creating models" do
111
-
112
- before{ subject.create db2 }
113
- after{ subject.drop db2 }
114
-
115
- it "should create a model instance in the current schema" do
116
- subject.switch! db2
117
- db2_count = User.count + x.times{ User.create }
118
-
119
- subject.switch! db1
120
- db_count = User.count + x.times{ User.create }
121
-
122
- subject.switch! db2
123
- expect(User.count).to eq(db2_count)
124
-
125
- subject.switch! db1
126
- expect(User.count).to eq(db_count)
127
- end
128
- end
129
-
130
- context "with excluded models" do
131
-
132
- before do
133
- Apartment.configure do |config|
134
- config.excluded_models = ["Company"]
135
- end
136
- subject.init
137
- end
138
-
139
- after do
140
- # Apartment::Tenant.init creates per model connection.
141
- # Remove the connection after testing not to unintentionally keep the connection across tests.
142
- Apartment.excluded_models.each do |excluded_model|
143
- excluded_model.constantize.remove_connection
144
- end
145
- end
146
-
147
- it "should create excluded models in public schema" do
148
- subject.reset # ensure we're on public schema
149
- count = Company.count + x.times{ Company.create }
150
-
151
- subject.switch! db1
152
- x.times{ Company.create }
153
- expect(Company.count).to eq(count + x)
154
- subject.reset
155
- expect(Company.count).to eq(count + x)
156
- end
157
- end
158
- end
159
- end
160
-
161
- context "seed paths" do
162
- before do
163
- Apartment.configure do |config|
164
- config.excluded_models = []
165
- config.use_schemas = true
166
- config.seed_after_create = true
167
- end
168
- end
169
-
170
- after{ subject.drop db1 }
171
-
172
- it 'should seed from default path' do
173
- subject.create db1
174
- subject.switch! db1
175
- expect(User.count).to eq(3)
176
- expect(User.first.name).to eq('Some User 0')
177
- end
178
-
179
- it 'should seed from custom path' do
180
- Apartment.configure do |config|
181
- config.seed_data_file = "#{Rails.root}/db/seeds/import.rb"
182
- end
183
- subject.create db1
184
- subject.switch! db1
185
- expect(User.count).to eq(6)
186
- expect(User.first.name).to eq('Different User 0')
187
- end
188
- end
189
- end
190
- end
@@ -1,112 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Apartment do
4
-
5
- describe "#config" do
6
-
7
- let(:excluded_models){ ["Company"] }
8
- let(:seed_data_file_path){ "#{Rails.root}/db/seeds/import.rb" }
9
-
10
- def tenant_names_from_array(names)
11
- names.each_with_object({}) do |tenant, hash|
12
- hash[tenant] = Apartment.connection_config
13
- end.with_indifferent_access
14
- end
15
-
16
- it "should yield the Apartment object" do
17
- Apartment.configure do |config|
18
- config.excluded_models = []
19
- expect(config).to eq(Apartment)
20
- end
21
- end
22
-
23
- it "should set excluded models" do
24
- Apartment.configure do |config|
25
- config.excluded_models = excluded_models
26
- end
27
- expect(Apartment.excluded_models).to eq(excluded_models)
28
- end
29
-
30
- it "should set use_schemas" do
31
- Apartment.configure do |config|
32
- config.excluded_models = []
33
- config.use_schemas = false
34
- end
35
- expect(Apartment.use_schemas).to be false
36
- end
37
-
38
- it "should set seed_data_file" do
39
- Apartment.configure do |config|
40
- config.seed_data_file = seed_data_file_path
41
- end
42
- expect(Apartment.seed_data_file).to eq(seed_data_file_path)
43
- end
44
-
45
- it "should set seed_after_create" do
46
- Apartment.configure do |config|
47
- config.excluded_models = []
48
- config.seed_after_create = true
49
- end
50
- expect(Apartment.seed_after_create).to be true
51
- end
52
-
53
- context "databases" do
54
- let(:users_conf_hash) { { port: 5444 } }
55
-
56
- before do
57
- Apartment.configure do |config|
58
- config.tenant_names = tenant_names
59
- end
60
- end
61
-
62
- context "tenant_names as string array" do
63
- let(:tenant_names) { ['users', 'companies'] }
64
-
65
- it "should return object if it doesnt respond_to call" do
66
- expect(Apartment.tenant_names).to eq(tenant_names_from_array(tenant_names).keys)
67
- end
68
-
69
- it "should set tenants_with_config" do
70
- expect(Apartment.tenants_with_config).to eq(tenant_names_from_array(tenant_names))
71
- end
72
- end
73
-
74
- context "tenant_names as proc returning an array" do
75
- let(:tenant_names) { lambda { ['users', 'companies'] } }
76
-
77
- it "should return object if it doesnt respond_to call" do
78
- expect(Apartment.tenant_names).to eq(tenant_names_from_array(tenant_names.call).keys)
79
- end
80
-
81
- it "should set tenants_with_config" do
82
- expect(Apartment.tenants_with_config).to eq(tenant_names_from_array(tenant_names.call))
83
- end
84
- end
85
-
86
- context "tenant_names as Hash" do
87
- let(:tenant_names) { { users: users_conf_hash }.with_indifferent_access }
88
-
89
- it "should return object if it doesnt respond_to call" do
90
- expect(Apartment.tenant_names).to eq(tenant_names.keys)
91
- end
92
-
93
- it "should set tenants_with_config" do
94
- expect(Apartment.tenants_with_config).to eq(tenant_names)
95
- end
96
- end
97
-
98
- context "tenant_names as proc returning a Hash" do
99
- let(:tenant_names) { lambda { { users: users_conf_hash }.with_indifferent_access } }
100
-
101
- it "should return object if it doesnt respond_to call" do
102
- expect(Apartment.tenant_names).to eq(tenant_names.call.keys)
103
- end
104
-
105
- it "should set tenants_with_config" do
106
- expect(Apartment.tenants_with_config).to eq(tenant_names.call)
107
- end
108
- end
109
- end
110
-
111
- end
112
- end
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
- require 'apartment/elevators/domain'
3
-
4
- describe Apartment::Elevators::Domain do
5
-
6
- subject(:elevator){ described_class.new(Proc.new{}) }
7
-
8
- describe "#parse_tenant_name" do
9
- it "parses the host for a domain name" do
10
- request = ActionDispatch::Request.new('HTTP_HOST' => 'example.com')
11
- expect(elevator.parse_tenant_name(request)).to eq('example')
12
- end
13
-
14
- it "ignores a www prefix and domain suffix" do
15
- request = ActionDispatch::Request.new('HTTP_HOST' => 'www.example.bc.ca')
16
- expect(elevator.parse_tenant_name(request)).to eq('example')
17
- end
18
-
19
- it "returns nil if there is no host" do
20
- request = ActionDispatch::Request.new('HTTP_HOST' => '')
21
- expect(elevator.parse_tenant_name(request)).to be_nil
22
- end
23
- end
24
-
25
- describe "#call" do
26
- it "switches to the proper tenant" do
27
- expect(Apartment::Tenant).to receive(:switch).with('example')
28
-
29
- elevator.call('HTTP_HOST' => 'www.example.com')
30
- end
31
- end
32
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
- require 'apartment/elevators/first_subdomain'
3
-
4
- describe Apartment::Elevators::FirstSubdomain do
5
- describe "subdomain" do
6
- subject { described_class.new("test").parse_tenant_name(request) }
7
- let(:request) { double(:request, :host => "#{subdomain}.example.com") }
8
-
9
- context "one subdomain" do
10
- let(:subdomain) { "test" }
11
- it { is_expected.to eq("test") }
12
- end
13
-
14
- context "nested subdomains" do
15
- let(:subdomain) { "test1.test2" }
16
- it { is_expected.to eq("test1") }
17
- end
18
-
19
- context "no subdomain" do
20
- let(:subdomain) { nil }
21
- it { is_expected.to eq(nil) }
22
- end
23
- end
24
- end
@@ -1,54 +0,0 @@
1
- require 'spec_helper'
2
- require 'apartment/elevators/generic'
3
-
4
- describe Apartment::Elevators::Generic do
5
-
6
- class MyElevator < described_class
7
- def parse_tenant_name(*)
8
- 'tenant2'
9
- end
10
- end
11
-
12
- subject(:elevator){ described_class.new(Proc.new{}) }
13
-
14
- describe "#call" do
15
- it "calls the processor if given" do
16
- elevator = described_class.new(Proc.new{}, Proc.new{'tenant1'})
17
-
18
- expect(Apartment::Tenant).to receive(:switch).with('tenant1')
19
-
20
- elevator.call('HTTP_HOST' => 'foo.bar.com')
21
- end
22
-
23
- it "raises if parse_tenant_name not implemented" do
24
- expect {
25
- elevator.call('HTTP_HOST' => 'foo.bar.com')
26
- }.to raise_error(RuntimeError)
27
- end
28
-
29
- it "switches to the parsed db_name" do
30
- elevator = MyElevator.new(Proc.new{})
31
-
32
- expect(Apartment::Tenant).to receive(:switch).with('tenant2')
33
-
34
- elevator.call('HTTP_HOST' => 'foo.bar.com')
35
- end
36
-
37
- it "calls the block implementation of `switch`" do
38
- elevator = MyElevator.new(Proc.new{}, Proc.new{'tenant2'})
39
-
40
- expect(Apartment::Tenant).to receive(:switch).with('tenant2').and_yield
41
- elevator.call('HTTP_HOST' => 'foo.bar.com')
42
- end
43
-
44
- it "does not call `switch` if no database given" do
45
- app = Proc.new{}
46
- elevator = MyElevator.new(app, Proc.new{})
47
-
48
- expect(Apartment::Tenant).not_to receive(:switch)
49
- expect(app).to receive :call
50
-
51
- elevator.call('HTTP_HOST' => 'foo.bar.com')
52
- end
53
- end
54
- end
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
- require 'apartment/elevators/host_hash'
3
-
4
- describe Apartment::Elevators::HostHash do
5
-
6
- subject(:elevator){ Apartment::Elevators::HostHash.new(Proc.new{}, 'example.com' => 'example_tenant') }
7
-
8
- describe "#parse_tenant_name" do
9
- it "parses the host for a domain name" do
10
- request = ActionDispatch::Request.new('HTTP_HOST' => 'example.com')
11
- expect(elevator.parse_tenant_name(request)).to eq('example_tenant')
12
- end
13
-
14
- it "raises TenantNotFound exception if there is no host" do
15
- request = ActionDispatch::Request.new('HTTP_HOST' => '')
16
- expect { elevator.parse_tenant_name(request) }.to raise_error(Apartment::TenantNotFound)
17
- end
18
-
19
- it "raises TenantNotFound exception if there is no database associated to current host" do
20
- request = ActionDispatch::Request.new('HTTP_HOST' => 'example2.com')
21
- expect { elevator.parse_tenant_name(request) }.to raise_error(Apartment::TenantNotFound)
22
- end
23
- end
24
-
25
- describe "#call" do
26
- it "switches to the proper tenant" do
27
- expect(Apartment::Tenant).to receive(:switch).with('example_tenant')
28
-
29
- elevator.call('HTTP_HOST' => 'example.com')
30
- end
31
- end
32
- end