apartment 0.13.0.1 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/HISTORY.md +28 -29
- data/apartment.gemspec +12 -15
- data/lib/apartment.rb +21 -34
- data/lib/apartment/adapters/abstract_adapter.rb +64 -64
- data/lib/apartment/adapters/postgresql_adapter.rb +52 -51
- data/lib/apartment/database.rb +20 -22
- data/lib/apartment/delayed_job/hooks.rb +5 -5
- data/lib/apartment/elevators/subdomain.rb +11 -27
- data/lib/apartment/version.rb +1 -1
- data/spec/adapters/postgresql_adapter_spec.rb +29 -38
- data/spec/apartment_spec.rb +1 -1
- data/spec/dummy/db/schema.rb +1 -7
- data/spec/integration/database_integration_spec.rb +44 -44
- data/spec/integration/middleware/subdomain_elevator_spec.rb +15 -15
- data/spec/spec_helper.rb +3 -7
- data/spec/support/apartment_helpers.rb +8 -8
- data/spec/tasks/apartment_rake_spec.rb +1 -0
- data/spec/unit/config_spec.rb +18 -48
- data/spec/unit/middleware/subdomain_elevator_spec.rb +8 -11
- data/spec/unit/reloader_spec.rb +6 -6
- metadata +92 -107
@@ -1,23 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Apartment::Elevators::Subdomain do
|
4
|
-
|
4
|
+
|
5
5
|
describe "#subdomain" do
|
6
6
|
it "should parse subdomain" do
|
7
|
+
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.com')
|
7
8
|
elevator = Apartment::Elevators::Subdomain.new(nil)
|
8
|
-
elevator.
|
9
|
+
elevator.subdomain(request).should == 'foo'
|
9
10
|
end
|
10
|
-
|
11
|
+
|
11
12
|
it "should return nil when no subdomain" do
|
13
|
+
request = ActionDispatch::Request.new('HTTP_HOST' => 'bar.com')
|
12
14
|
elevator = Apartment::Elevators::Subdomain.new(nil)
|
13
|
-
elevator.
|
15
|
+
elevator.subdomain(request).should be_nil
|
14
16
|
end
|
15
|
-
|
16
|
-
it "should only care about first subdomain" do
|
17
|
-
elevator = Apartment::Elevators::Subdomain.new(nil)
|
18
|
-
elevator.send(:subdomain, 'foo.baz.bar.com').should == 'foo'
|
19
|
-
end
|
20
|
-
|
17
|
+
|
21
18
|
end
|
22
|
-
|
19
|
+
|
23
20
|
end
|
data/spec/unit/reloader_spec.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Apartment::Reloader do
|
4
|
-
|
4
|
+
|
5
5
|
context "using postgresql schemas" do
|
6
|
-
|
6
|
+
|
7
7
|
before do
|
8
8
|
Apartment.excluded_models = ["Company"]
|
9
9
|
Company.reset_table_name # ensure we're clean
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
subject{ Apartment::Reloader.new(mock("Rack::Application", :call => nil)) }
|
13
|
-
|
13
|
+
|
14
14
|
it "should initialize apartment when called" do
|
15
15
|
Company.table_name.should_not include('public.')
|
16
16
|
subject.call(mock('env'))
|
17
17
|
Company.table_name.should include('public.')
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
21
|
-
|
20
|
+
|
21
|
+
|
22
22
|
end
|
metadata
CHANGED
@@ -1,158 +1,140 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: apartment
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.13.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Ryan Brunner
|
9
9
|
- Brad Robertson
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 3.0.10
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: *2154769620
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: rack
|
28
|
-
requirement: &2154769080 !ruby/object:Gem::Requirement
|
13
|
+
|
14
|
+
date: 2011-11-08 00:00:00 -05:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: rails
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
29
20
|
none: false
|
30
|
-
requirements:
|
21
|
+
requirements:
|
31
22
|
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 3.1.1
|
34
25
|
type: :runtime
|
35
26
|
prerelease: false
|
36
|
-
version_requirements: *
|
37
|
-
- !ruby/object:Gem::Dependency
|
27
|
+
version_requirements: *id001
|
28
|
+
- !ruby/object:Gem::Dependency
|
38
29
|
name: rake
|
39
|
-
requirement: &
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
31
|
none: false
|
41
|
-
requirements:
|
32
|
+
requirements:
|
42
33
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
34
|
+
- !ruby/object:Gem::Version
|
44
35
|
version: 0.8.7
|
45
36
|
type: :development
|
46
37
|
prerelease: false
|
47
|
-
version_requirements: *
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rails
|
50
|
-
requirement: &2154767940 !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
|
-
requirements:
|
53
|
-
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 3.0.10
|
56
|
-
type: :development
|
57
|
-
prerelease: false
|
58
|
-
version_requirements: *2154767940
|
59
|
-
- !ruby/object:Gem::Dependency
|
38
|
+
version_requirements: *id002
|
39
|
+
- !ruby/object:Gem::Dependency
|
60
40
|
name: sqlite3
|
61
|
-
requirement: &
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
62
42
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version:
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
67
47
|
type: :development
|
68
48
|
prerelease: false
|
69
|
-
version_requirements: *
|
70
|
-
- !ruby/object:Gem::Dependency
|
49
|
+
version_requirements: *id003
|
50
|
+
- !ruby/object:Gem::Dependency
|
71
51
|
name: rspec
|
72
|
-
requirement: &
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
53
|
none: false
|
74
|
-
requirements:
|
54
|
+
requirements:
|
75
55
|
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
56
|
+
- !ruby/object:Gem::Version
|
77
57
|
version: 2.6.0
|
78
58
|
type: :development
|
79
59
|
prerelease: false
|
80
|
-
version_requirements: *
|
81
|
-
- !ruby/object:Gem::Dependency
|
60
|
+
version_requirements: *id004
|
61
|
+
- !ruby/object:Gem::Dependency
|
82
62
|
name: rspec-rails
|
83
|
-
requirement: &
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
64
|
none: false
|
85
|
-
requirements:
|
65
|
+
requirements:
|
86
66
|
- - ~>
|
87
|
-
- !ruby/object:Gem::Version
|
67
|
+
- !ruby/object:Gem::Version
|
88
68
|
version: 2.6.1
|
89
69
|
type: :development
|
90
70
|
prerelease: false
|
91
|
-
version_requirements: *
|
92
|
-
- !ruby/object:Gem::Dependency
|
71
|
+
version_requirements: *id005
|
72
|
+
- !ruby/object:Gem::Dependency
|
93
73
|
name: capybara
|
94
|
-
requirement: &
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
75
|
none: false
|
96
|
-
requirements:
|
97
|
-
- - =
|
98
|
-
- !ruby/object:Gem::Version
|
76
|
+
requirements:
|
77
|
+
- - "="
|
78
|
+
- !ruby/object:Gem::Version
|
99
79
|
version: 1.0.0
|
100
80
|
type: :development
|
101
81
|
prerelease: false
|
102
|
-
version_requirements: *
|
103
|
-
- !ruby/object:Gem::Dependency
|
82
|
+
version_requirements: *id006
|
83
|
+
- !ruby/object:Gem::Dependency
|
104
84
|
name: pg
|
105
|
-
requirement: &
|
85
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
106
86
|
none: false
|
107
|
-
requirements:
|
87
|
+
requirements:
|
108
88
|
- - ~>
|
109
|
-
- !ruby/object:Gem::Version
|
89
|
+
- !ruby/object:Gem::Version
|
110
90
|
version: 0.11.0
|
111
91
|
type: :development
|
112
92
|
prerelease: false
|
113
|
-
version_requirements: *
|
114
|
-
- !ruby/object:Gem::Dependency
|
93
|
+
version_requirements: *id007
|
94
|
+
- !ruby/object:Gem::Dependency
|
115
95
|
name: mysql2
|
116
|
-
requirement: &
|
96
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
117
97
|
none: false
|
118
|
-
requirements:
|
119
|
-
- - =
|
120
|
-
- !ruby/object:Gem::Version
|
98
|
+
requirements:
|
99
|
+
- - "="
|
100
|
+
- !ruby/object:Gem::Version
|
121
101
|
version: 0.2.7
|
122
102
|
type: :development
|
123
103
|
prerelease: false
|
124
|
-
version_requirements: *
|
125
|
-
- !ruby/object:Gem::Dependency
|
104
|
+
version_requirements: *id008
|
105
|
+
- !ruby/object:Gem::Dependency
|
126
106
|
name: silent-postgres
|
127
|
-
requirement: &
|
107
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
128
108
|
none: false
|
129
|
-
requirements:
|
109
|
+
requirements:
|
130
110
|
- - ~>
|
131
|
-
- !ruby/object:Gem::Version
|
111
|
+
- !ruby/object:Gem::Version
|
132
112
|
version: 0.1.1
|
133
113
|
type: :development
|
134
114
|
prerelease: false
|
135
|
-
version_requirements: *
|
136
|
-
- !ruby/object:Gem::Dependency
|
115
|
+
version_requirements: *id009
|
116
|
+
- !ruby/object:Gem::Dependency
|
137
117
|
name: delayed_job
|
138
|
-
requirement: &
|
118
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
139
119
|
none: false
|
140
|
-
requirements:
|
120
|
+
requirements:
|
141
121
|
- - ~>
|
142
|
-
- !ruby/object:Gem::Version
|
122
|
+
- !ruby/object:Gem::Version
|
143
123
|
version: 2.1.4
|
144
124
|
type: :development
|
145
125
|
prerelease: false
|
146
|
-
version_requirements: *
|
147
|
-
description: Apartment allows applications
|
148
|
-
|
149
|
-
email:
|
126
|
+
version_requirements: *id010
|
127
|
+
description: Apartment allows Rails applications to deal with database multitenancy
|
128
|
+
email:
|
150
129
|
- ryan@ryanbrunner.com
|
151
130
|
- bradleyrobertson@gmail.com
|
152
131
|
executables: []
|
132
|
+
|
153
133
|
extensions: []
|
134
|
+
|
154
135
|
extra_rdoc_files: []
|
155
|
-
|
136
|
+
|
137
|
+
files:
|
156
138
|
- .gitignore
|
157
139
|
- .rspec
|
158
140
|
- .rvmrc
|
@@ -230,36 +212,39 @@ files:
|
|
230
212
|
- spec/unit/middleware/subdomain_elevator_spec.rb
|
231
213
|
- spec/unit/migrator_spec.rb
|
232
214
|
- spec/unit/reloader_spec.rb
|
215
|
+
has_rdoc: true
|
233
216
|
homepage: http://github.com/bradrobertson/apartment
|
234
|
-
licenses:
|
217
|
+
licenses:
|
235
218
|
- MIT
|
236
219
|
post_install_message:
|
237
220
|
rdoc_options: []
|
238
|
-
|
221
|
+
|
222
|
+
require_paths:
|
239
223
|
- lib
|
240
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
224
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
241
225
|
none: false
|
242
|
-
requirements:
|
243
|
-
- -
|
244
|
-
- !ruby/object:Gem::Version
|
245
|
-
|
246
|
-
segments:
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
hash: -2586480540333121746
|
230
|
+
segments:
|
247
231
|
- 0
|
248
|
-
|
249
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
|
+
version: "0"
|
233
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
250
234
|
none: false
|
251
|
-
requirements:
|
252
|
-
- -
|
253
|
-
- !ruby/object:Gem::Version
|
254
|
-
|
255
|
-
segments:
|
235
|
+
requirements:
|
236
|
+
- - ">="
|
237
|
+
- !ruby/object:Gem::Version
|
238
|
+
hash: -2586480540333121746
|
239
|
+
segments:
|
256
240
|
- 0
|
257
|
-
|
241
|
+
version: "0"
|
258
242
|
requirements: []
|
243
|
+
|
259
244
|
rubyforge_project:
|
260
|
-
rubygems_version: 1.
|
245
|
+
rubygems_version: 1.6.2
|
261
246
|
signing_key:
|
262
247
|
specification_version: 3
|
263
|
-
summary: A Ruby gem for managing database multitenancy in
|
264
|
-
ActiveRecord
|
248
|
+
summary: A Ruby gem for managing database multitenancy in Rails applications
|
265
249
|
test_files: []
|
250
|
+
|