ros-apartment 2.3.0.alpha1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.pryrc +5 -3
- data/.rubocop.yml +36 -0
- data/.rubocop_todo.yml +439 -0
- data/.ruby-version +1 -0
- data/Appraisals +31 -52
- data/CHANGELOG.md +965 -0
- data/Gemfile +2 -7
- data/Guardfile +3 -16
- data/README.md +121 -44
- data/Rakefile +42 -31
- data/lib/apartment/active_record/connection_handling.rb +31 -0
- data/lib/apartment/active_record/internal_metadata.rb +9 -0
- data/lib/apartment/active_record/postgresql_adapter.rb +43 -0
- data/lib/apartment/active_record/schema_migration.rb +11 -0
- data/lib/apartment/adapters/abstract_adapter.rb +52 -46
- data/lib/apartment/adapters/abstract_jdbc_adapter.rb +5 -3
- data/lib/apartment/adapters/jdbc_mysql_adapter.rb +3 -3
- data/lib/apartment/adapters/jdbc_postgresql_adapter.rb +19 -13
- data/lib/apartment/adapters/mysql2_adapter.rb +15 -9
- data/lib/apartment/adapters/postgis_adapter.rb +3 -2
- data/lib/apartment/adapters/postgresql_adapter.rb +79 -31
- data/lib/apartment/adapters/sqlite3_adapter.rb +18 -8
- data/lib/apartment/adapters/trilogy_adapter.rb +29 -0
- data/lib/apartment/console.rb +23 -11
- data/lib/apartment/custom_console.rb +42 -0
- data/lib/apartment/deprecation.rb +2 -1
- data/lib/apartment/elevators/domain.rb +4 -3
- data/lib/apartment/elevators/first_subdomain.rb +3 -2
- data/lib/apartment/elevators/generic.rb +4 -3
- data/lib/apartment/elevators/host.rb +6 -1
- data/lib/apartment/elevators/host_hash.rb +6 -2
- data/lib/apartment/elevators/subdomain.rb +9 -5
- data/lib/apartment/log_subscriber.rb +45 -0
- data/lib/apartment/migrator.rb +7 -24
- data/lib/apartment/model.rb +29 -0
- data/lib/apartment/railtie.rb +21 -20
- data/lib/apartment/tasks/enhancements.rb +4 -6
- data/lib/apartment/tasks/task_helper.rb +52 -0
- data/lib/apartment/tenant.rb +7 -10
- data/lib/apartment/version.rb +3 -1
- data/lib/apartment.rb +46 -15
- data/lib/generators/apartment/install/install_generator.rb +4 -3
- data/lib/generators/apartment/install/templates/apartment.rb +10 -3
- data/lib/tasks/apartment.rake +48 -87
- data/ros-apartment.gemspec +65 -0
- metadata +181 -264
- data/.github/ISSUE_TEMPLATE.md +0 -21
- data/.travis.yml +0 -65
- data/HISTORY.md +0 -398
- data/TODO.md +0 -51
- data/apartment.gemspec +0 -46
- data/docker-compose.yml +0 -33
- data/gemfiles/rails_4_2.gemfile +0 -23
- data/gemfiles/rails_5_0.gemfile +0 -22
- data/gemfiles/rails_5_1.gemfile +0 -22
- data/gemfiles/rails_5_2.gemfile +0 -18
- data/gemfiles/rails_6_0.gemfile +0 -22
- data/gemfiles/rails_master.gemfile +0 -22
- data/lib/apartment/reloader.rb +0 -21
- data/spec/adapters/jdbc_mysql_adapter_spec.rb +0 -19
- data/spec/adapters/jdbc_postgresql_adapter_spec.rb +0 -41
- data/spec/adapters/mysql2_adapter_spec.rb +0 -59
- data/spec/adapters/postgresql_adapter_spec.rb +0 -61
- data/spec/adapters/sqlite3_adapter_spec.rb +0 -83
- data/spec/apartment_spec.rb +0 -11
- data/spec/config/database.yml.sample +0 -49
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/controllers/application_controller.rb +0 -6
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/models/company.rb +0 -3
- data/spec/dummy/app/models/user.rb +0 -3
- data/spec/dummy/app/views/application/index.html.erb +0 -1
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/config/application.rb +0 -49
- data/spec/dummy/config/boot.rb +0 -11
- data/spec/dummy/config/database.yml.sample +0 -44
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -28
- data/spec/dummy/config/environments/production.rb +0 -51
- data/spec/dummy/config/environments/test.rb +0 -34
- data/spec/dummy/config/initializers/apartment.rb +0 -4
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/inflections.rb +0 -10
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -3
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/migrate/20110613152810_create_dummy_models.rb +0 -39
- data/spec/dummy/db/migrate/20111202022214_create_table_books.rb +0 -14
- data/spec/dummy/db/migrate/20180415260934_create_public_tokens.rb +0 -13
- data/spec/dummy/db/schema.rb +0 -55
- data/spec/dummy/db/seeds/import.rb +0 -5
- data/spec/dummy/db/seeds.rb +0 -5
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -26
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/dummy_engine/.gitignore +0 -8
- data/spec/dummy_engine/Gemfile +0 -15
- data/spec/dummy_engine/Rakefile +0 -34
- data/spec/dummy_engine/bin/rails +0 -12
- data/spec/dummy_engine/config/initializers/apartment.rb +0 -51
- data/spec/dummy_engine/dummy_engine.gemspec +0 -24
- data/spec/dummy_engine/lib/dummy_engine/engine.rb +0 -4
- data/spec/dummy_engine/lib/dummy_engine/version.rb +0 -3
- data/spec/dummy_engine/lib/dummy_engine.rb +0 -4
- data/spec/dummy_engine/test/dummy/Rakefile +0 -6
- data/spec/dummy_engine/test/dummy/config/application.rb +0 -22
- data/spec/dummy_engine/test/dummy/config/boot.rb +0 -5
- data/spec/dummy_engine/test/dummy/config/database.yml +0 -25
- data/spec/dummy_engine/test/dummy/config/environment.rb +0 -5
- data/spec/dummy_engine/test/dummy/config/environments/development.rb +0 -37
- data/spec/dummy_engine/test/dummy/config/environments/production.rb +0 -78
- data/spec/dummy_engine/test/dummy/config/environments/test.rb +0 -39
- data/spec/dummy_engine/test/dummy/config/initializers/assets.rb +0 -8
- data/spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy_engine/test/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy_engine/test/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy_engine/test/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy_engine/test/dummy/config/locales/en.yml +0 -23
- data/spec/dummy_engine/test/dummy/config/routes.rb +0 -56
- data/spec/dummy_engine/test/dummy/config/secrets.yml +0 -22
- data/spec/dummy_engine/test/dummy/config.ru +0 -4
- data/spec/examples/connection_adapter_examples.rb +0 -42
- data/spec/examples/generic_adapter_custom_configuration_example.rb +0 -95
- data/spec/examples/generic_adapter_examples.rb +0 -163
- data/spec/examples/schema_adapter_examples.rb +0 -234
- data/spec/integration/apartment_rake_integration_spec.rb +0 -107
- data/spec/integration/query_caching_spec.rb +0 -81
- data/spec/integration/use_within_an_engine_spec.rb +0 -28
- data/spec/schemas/v1.rb +0 -16
- data/spec/schemas/v2.rb +0 -43
- data/spec/schemas/v3.rb +0 -49
- data/spec/spec_helper.rb +0 -61
- data/spec/support/apartment_helpers.rb +0 -43
- data/spec/support/capybara_sessions.rb +0 -15
- data/spec/support/config.rb +0 -10
- data/spec/support/contexts.rb +0 -52
- data/spec/support/requirements.rb +0 -35
- data/spec/support/setup.rb +0 -46
- data/spec/tasks/apartment_rake_spec.rb +0 -129
- data/spec/tenant_spec.rb +0 -190
- data/spec/unit/config_spec.rb +0 -112
- data/spec/unit/elevators/domain_spec.rb +0 -32
- data/spec/unit/elevators/first_subdomain_spec.rb +0 -24
- data/spec/unit/elevators/generic_spec.rb +0 -54
- data/spec/unit/elevators/host_hash_spec.rb +0 -32
- data/spec/unit/elevators/host_spec.rb +0 -89
- data/spec/unit/elevators/subdomain_spec.rb +0 -76
- data/spec/unit/migrator_spec.rb +0 -77
- data/spec/unit/reloader_spec.rb +0 -24
@@ -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
|
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'apartment/elevators/host'
|
3
|
-
|
4
|
-
describe Apartment::Elevators::Host do
|
5
|
-
|
6
|
-
subject(:elevator){ described_class.new(Proc.new{}) }
|
7
|
-
|
8
|
-
describe "#parse_tenant_name" do
|
9
|
-
|
10
|
-
it "should return nil when no host" do
|
11
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => '')
|
12
|
-
expect(elevator.parse_tenant_name(request)).to be_nil
|
13
|
-
end
|
14
|
-
|
15
|
-
context "assuming no ignored_first_subdomains" do
|
16
|
-
before { allow(described_class).to receive(:ignored_first_subdomains).and_return([]) }
|
17
|
-
|
18
|
-
context "with 3 parts" do
|
19
|
-
it "should return the whole host" do
|
20
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.com')
|
21
|
-
expect(elevator.parse_tenant_name(request)).to eq('foo.bar.com')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "with 6 parts" do
|
26
|
-
it "should return the whole host" do
|
27
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'one.two.three.foo.bar.com')
|
28
|
-
expect(elevator.parse_tenant_name(request)).to eq('one.two.three.foo.bar.com')
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "assuming ignored_first_subdomains is set" do
|
34
|
-
before { allow(described_class).to receive(:ignored_first_subdomains).and_return(%w{www foo}) }
|
35
|
-
|
36
|
-
context "with 3 parts" do
|
37
|
-
it "should return host without www" do
|
38
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'www.bar.com')
|
39
|
-
expect(elevator.parse_tenant_name(request)).to eq('bar.com')
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should return host without foo" do
|
43
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.com')
|
44
|
-
expect(elevator.parse_tenant_name(request)).to eq('bar.com')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "with 6 parts" do
|
49
|
-
it "should return host without www" do
|
50
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'www.one.two.three.foo.bar.com')
|
51
|
-
expect(elevator.parse_tenant_name(request)).to eq('one.two.three.foo.bar.com')
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should return host without www" do
|
55
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.one.two.three.bar.com')
|
56
|
-
expect(elevator.parse_tenant_name(request)).to eq('one.two.three.bar.com')
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "assuming localhost" do
|
62
|
-
it "should return localhost" do
|
63
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'localhost')
|
64
|
-
expect(elevator.parse_tenant_name(request)).to eq('localhost')
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context "assuming ip address" do
|
69
|
-
it "should return the ip address" do
|
70
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => '127.0.0.1')
|
71
|
-
expect(elevator.parse_tenant_name(request)).to eq('127.0.0.1')
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "#call" do
|
77
|
-
it "switches to the proper tenant" do
|
78
|
-
allow(described_class).to receive(:ignored_first_subdomains).and_return([])
|
79
|
-
expect(Apartment::Tenant).to receive(:switch).with('foo.bar.com')
|
80
|
-
elevator.call('HTTP_HOST' => 'foo.bar.com')
|
81
|
-
end
|
82
|
-
|
83
|
-
it "ignores ignored_first_subdomains" do
|
84
|
-
allow(described_class).to receive(:ignored_first_subdomains).and_return(%w{foo})
|
85
|
-
expect(Apartment::Tenant).to receive(:switch).with('bar.com')
|
86
|
-
elevator.call('HTTP_HOST' => 'foo.bar.com')
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'apartment/elevators/subdomain'
|
3
|
-
|
4
|
-
describe Apartment::Elevators::Subdomain do
|
5
|
-
|
6
|
-
subject(:elevator){ described_class.new(Proc.new{}) }
|
7
|
-
|
8
|
-
describe "#parse_tenant_name" do
|
9
|
-
context "assuming one tld" do
|
10
|
-
it "should parse subdomain" do
|
11
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.com')
|
12
|
-
expect(elevator.parse_tenant_name(request)).to eq('foo')
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should return nil when no subdomain" do
|
16
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'bar.com')
|
17
|
-
expect(elevator.parse_tenant_name(request)).to be_nil
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context "assuming two tlds" do
|
22
|
-
it "should parse subdomain in the third level domain" do
|
23
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.co.uk')
|
24
|
-
expect(elevator.parse_tenant_name(request)).to eq("foo")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should return nil when no subdomain in the third level domain" do
|
28
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'bar.co.uk')
|
29
|
-
expect(elevator.parse_tenant_name(request)).to be_nil
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "assuming two subdomains" do
|
34
|
-
it "should parse two subdomains in the two level domain" do
|
35
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.xyz.bar.com')
|
36
|
-
expect(elevator.parse_tenant_name(request)).to eq("foo")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should parse two subdomains in the third level domain" do
|
40
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.xyz.bar.co.uk')
|
41
|
-
expect(elevator.parse_tenant_name(request)).to eq("foo")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "assuming localhost" do
|
46
|
-
it "should return nil for localhost" do
|
47
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => 'localhost')
|
48
|
-
expect(elevator.parse_tenant_name(request)).to be_nil
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context "assuming ip address" do
|
53
|
-
it "should return nil for an ip address" do
|
54
|
-
request = ActionDispatch::Request.new('HTTP_HOST' => '127.0.0.1')
|
55
|
-
expect(elevator.parse_tenant_name(request)).to be_nil
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "#call" do
|
61
|
-
it "switches to the proper tenant" do
|
62
|
-
expect(Apartment::Tenant).to receive(:switch).with('tenant1')
|
63
|
-
elevator.call('HTTP_HOST' => 'tenant1.example.com')
|
64
|
-
end
|
65
|
-
|
66
|
-
it "ignores excluded subdomains" do
|
67
|
-
described_class.excluded_subdomains = %w{foo}
|
68
|
-
|
69
|
-
expect(Apartment::Tenant).not_to receive(:switch)
|
70
|
-
|
71
|
-
elevator.call('HTTP_HOST' => 'foo.bar.com')
|
72
|
-
|
73
|
-
described_class.excluded_subdomains = nil
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
data/spec/unit/migrator_spec.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'apartment/migrator'
|
3
|
-
|
4
|
-
describe Apartment::Migrator do
|
5
|
-
|
6
|
-
let(:tenant){ Apartment::Test.next_db }
|
7
|
-
|
8
|
-
# Don't need a real switch here, just testing behaviour
|
9
|
-
before { allow(Apartment::Tenant.adapter).to receive(:connect_to_new) }
|
10
|
-
|
11
|
-
context "with ActiveRecord below 5.2.0", skip: ActiveRecord.version >= Gem::Version.new("5.2.0") do
|
12
|
-
before do
|
13
|
-
allow(ActiveRecord::Migrator).to receive(:migrations_paths) { %w(spec/dummy/db/migrate) }
|
14
|
-
allow(Apartment::Migrator).to receive(:activerecord_below_5_2?) { true }
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "::migrate" do
|
18
|
-
it "switches and migrates" do
|
19
|
-
expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
|
20
|
-
expect(ActiveRecord::Migrator).to receive(:migrate)
|
21
|
-
|
22
|
-
Apartment::Migrator.migrate(tenant)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "::run" do
|
27
|
-
it "switches and runs" do
|
28
|
-
expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
|
29
|
-
expect(ActiveRecord::Migrator).to receive(:run).with(:up, anything, 1234)
|
30
|
-
|
31
|
-
Apartment::Migrator.run(:up, tenant, 1234)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "::rollback" do
|
36
|
-
it "switches and rolls back" do
|
37
|
-
expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
|
38
|
-
expect(ActiveRecord::Migrator).to receive(:rollback).with(anything, 2)
|
39
|
-
|
40
|
-
Apartment::Migrator.rollback(tenant, 2)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "with ActiveRecord above or equal to 5.2.0", skip: ActiveRecord.version < Gem::Version.new("5.2.0") do
|
46
|
-
before do
|
47
|
-
allow(Apartment::Migrator).to receive(:activerecord_below_5_2?) { false }
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "::migrate" do
|
51
|
-
it "switches and migrates" do
|
52
|
-
expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
|
53
|
-
expect_any_instance_of(ActiveRecord::MigrationContext).to receive(:migrate)
|
54
|
-
|
55
|
-
Apartment::Migrator.migrate(tenant)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "::run" do
|
60
|
-
it "switches and runs" do
|
61
|
-
expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
|
62
|
-
expect_any_instance_of(ActiveRecord::MigrationContext).to receive(:run).with(:up, 1234)
|
63
|
-
|
64
|
-
Apartment::Migrator.run(:up, tenant, 1234)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "::rollback" do
|
69
|
-
it "switches and rolls back" do
|
70
|
-
expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
|
71
|
-
expect_any_instance_of(ActiveRecord::MigrationContext).to receive(:rollback).with(2)
|
72
|
-
|
73
|
-
Apartment::Migrator.rollback(tenant, 2)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
data/spec/unit/reloader_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Apartment::Reloader do
|
4
|
-
|
5
|
-
context "using postgresql schemas" do
|
6
|
-
|
7
|
-
before do
|
8
|
-
Apartment.configure do |config|
|
9
|
-
config.excluded_models = ["Company"]
|
10
|
-
config.use_schemas = true
|
11
|
-
end
|
12
|
-
Apartment::Tenant.reload!(config)
|
13
|
-
Company.reset_table_name # ensure we're clean
|
14
|
-
end
|
15
|
-
|
16
|
-
subject{ Apartment::Reloader.new(double("Rack::Application", :call => nil)) }
|
17
|
-
|
18
|
-
it "should initialize apartment when called" do
|
19
|
-
expect(Company.table_name).not_to include('public.')
|
20
|
-
subject.call(double('env'))
|
21
|
-
expect(Company.table_name).to include('public.')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|