apartment 0.23.2 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +12 -1
- data/README.md +16 -13
- data/Rakefile +6 -1
- data/TODO.md +9 -14
- data/lib/apartment.rb +17 -3
- data/lib/apartment/adapters/abstract_adapter.rb +53 -44
- data/lib/apartment/adapters/jdbc_postgresql_adapter.rb +9 -9
- data/lib/apartment/adapters/mysql2_adapter.rb +15 -15
- data/lib/apartment/adapters/postgresql_adapter.rb +26 -18
- data/lib/apartment/adapters/sqlite3_adapter.rb +13 -13
- data/lib/apartment/database.rb +2 -2
- data/lib/apartment/elevators/host_hash.rb +3 -3
- data/lib/apartment/elevators/subdomain.rb +2 -3
- data/lib/apartment/migrator.rb +3 -3
- data/lib/apartment/railtie.rb +2 -1
- data/lib/apartment/tasks/enhancements.rb +26 -0
- data/lib/apartment/version.rb +1 -1
- data/lib/generators/apartment/install/templates/apartment.rb +13 -8
- data/lib/tasks/apartment.rake +34 -38
- data/spec/adapters/jdbc_mysql_adapter_spec.rb +2 -4
- data/spec/adapters/jdbc_postgresql_adapter_spec.rb +6 -6
- data/spec/adapters/mysql2_adapter_spec.rb +5 -5
- data/spec/adapters/postgresql_adapter_spec.rb +6 -6
- data/spec/adapters/sqlite3_adapter_spec.rb +2 -2
- data/spec/database_spec.rb +2 -2
- data/spec/dummy/config/initializers/apartment.rb +2 -2
- data/spec/examples/connection_adapter_examples.rb +2 -2
- data/spec/examples/generic_adapter_examples.rb +15 -15
- data/spec/examples/schema_adapter_examples.rb +6 -6
- data/spec/integration/apartment_rake_integration_spec.rb +4 -4
- data/spec/integration/query_caching_spec.rb +2 -2
- data/spec/support/requirements.rb +2 -5
- data/spec/tasks/apartment_rake_spec.rb +8 -9
- data/spec/unit/config_spec.rb +17 -10
- data/spec/unit/elevators/subdomain_spec.rb +26 -6
- metadata +3 -2
@@ -6,14 +6,34 @@ describe Apartment::Elevators::Subdomain do
|
|
6
6
|
subject(:elevator){ described_class.new(Proc.new{}) }
|
7
7
|
|
8
8
|
describe "#parse_tenant_name" do
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
context "assuming tld_length of 1" do
|
10
|
+
it "should parse subdomain" do
|
11
|
+
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.com')
|
12
|
+
elevator.parse_tenant_name(request).should == 'foo'
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should return nil when no subdomain" do
|
16
|
+
request = ActionDispatch::Request.new('HTTP_HOST' => 'bar.com')
|
17
|
+
elevator.parse_tenant_name(request).should be_nil
|
18
|
+
end
|
12
19
|
end
|
13
20
|
|
14
|
-
|
15
|
-
|
16
|
-
|
21
|
+
context "assuming tld_length of 2" do
|
22
|
+
before do
|
23
|
+
Apartment.configure do |config|
|
24
|
+
config.tld_length = 2
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should parse subdomain in the third level domain" do
|
29
|
+
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.co.uk')
|
30
|
+
elevator.parse_tenant_name(request).should == "foo"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should return nil when no subdomain in the third level domain" do
|
34
|
+
request = ActionDispatch::Request.new('HTTP_HOST' => 'bar.co.uk')
|
35
|
+
elevator.parse_tenant_name(request).should be_nil
|
36
|
+
end
|
17
37
|
end
|
18
38
|
end
|
19
39
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apartment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Brunner
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- lib/apartment/migrator.rb
|
196
196
|
- lib/apartment/railtie.rb
|
197
197
|
- lib/apartment/reloader.rb
|
198
|
+
- lib/apartment/tasks/enhancements.rb
|
198
199
|
- lib/apartment/version.rb
|
199
200
|
- lib/generators/apartment/install/USAGE
|
200
201
|
- lib/generators/apartment/install/install_generator.rb
|