houser 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d50dc68ec3f594a6648bee55ba34edb32125b769
4
- data.tar.gz: 6f892bba2adb73499b267b31b33b9c5e166d7fac
3
+ metadata.gz: f81835849938c975c56884b32bcc1eef251f0ce9
4
+ data.tar.gz: 486b4fa43d922768bff6cda1136c859a68331c50
5
5
  SHA512:
6
- metadata.gz: 9aa002ff57efc25dab9b52d5f9ec16ef678477a51c24a6092589529462a7a795c3244e991ececcd07feb895c32c77f6710789a80696cc10b39537471e5b71e24
7
- data.tar.gz: 2ef326f2e61d8faab3f3a8927890a86fb36377347303698299a6d2a4bf1587cda249a59c168402df290eaa482946538492725e2d0718c75ec3edd889fa817658
6
+ metadata.gz: 968a2856e091a3c6a443cbafffb60827143b3a5d0ea50cc7c85cfaea33c19c95b85e795ea1df86bf5da95bd3ab937ce6f065193d004db6eaf46bb987f6a27fba
7
+ data.tar.gz: a8641484fc827a7dd781f398fc1ddf112058798a7ae38a5b7db11a67337240dc10449fc85cace9c1241db18555cf52e1ee93457db44fb32c79f78d941bb47eff
@@ -1,4 +1,5 @@
1
1
  script: 'bundle exec rspec spec'
2
2
  gemfile:
3
3
  - gemfiles/rails3.gemfile
4
- - gemfiles/rails4.gemfile
4
+ - gemfiles/rails4.0.gemfile
5
+ - gemfiles/rails4.1.gemfile
data/Appraisals CHANGED
@@ -1,7 +1,12 @@
1
1
  appraise "rails3" do
2
- gem "rails", "3.2.17"
2
+ gem "rails", "3.2.18"
3
+ end
4
+
5
+ appraise "rails4.0" do
6
+ gem "rails", "4.0.10"
7
+ end
8
+
9
+ appraise "rails4.1" do
10
+ gem "rails", "4.1.2"
3
11
  end
4
12
 
5
- appraise "rails4" do
6
- gem "rails", "4.0.4"
7
- end
@@ -0,0 +1,5 @@
1
+ # 2.0.0
2
+
3
+ * X-Headers are deprecated (see [#6](https://github.com/radar/houser/issues/6)). Headers are now to be referenced as `Houser-Object` and `Houser-Subdomain`.
4
+
5
+
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ![Build Status](https://api.travis-ci.org/radar/houser.png?branch=master)
4
4
 
5
- This is the multitenancy gem that will be used in the Multitenancy with Rails book as an alternative method to PostgreSQL schemas which can have their own set of problems.
5
+ This is the multitenancy gem that is used in the Multitenancy with Rails book as an alternative method to PostgreSQL schemas which can have their own set of problems (such as backups taking an inordinately long time).
6
6
 
7
7
  Houser provides you with two Rack environment variables which can then be used in your application to scope resources correctly. That is all it does for the time being, and it will probably do more in the future.
8
8
 
@@ -18,17 +18,21 @@ And then execute:
18
18
 
19
19
  In `config/application.rb`, put this line:
20
20
 
21
- config.middleware.use Houser::Middleware,
22
- :class_name => 'Model'
21
+ ``` ruby
22
+ config.middleware.use Houser::Middleware,
23
+ :class_name => 'Model'
24
+ ```
23
25
 
24
26
  Where 'Model' is the class that you're scoping by.
25
27
 
26
28
  If you're using a TLD like `.co.uk` instead of `.com`, you will need to specify `tld_length` too:
27
29
 
28
- config.middleware.use Houser::Middleware,
29
- :class_name => 'Model',
30
- :tld_length => 2
31
-
30
+ ``` ruby
31
+ config.middleware.use Houser::Middleware,
32
+ :class_name => 'Model',
33
+ :tld_length => 2
34
+ ```
35
+
32
36
  ## Usage
33
37
 
34
38
  There are two rack environment variables set by the Houser middleware that you can use throughout your application to scope resources.
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "3.2.17"
5
+ gem "rails", "3.2.18"
6
6
 
7
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- houser (1.0.2)
4
+ houser (2.0.0)
5
5
  rack
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionmailer (3.2.17)
11
- actionpack (= 3.2.17)
10
+ actionmailer (3.2.18)
11
+ actionpack (= 3.2.18)
12
12
  mail (~> 2.5.4)
13
- actionpack (3.2.17)
14
- activemodel (= 3.2.17)
15
- activesupport (= 3.2.17)
13
+ actionpack (3.2.18)
14
+ activemodel (= 3.2.18)
15
+ activesupport (= 3.2.18)
16
16
  builder (~> 3.0.0)
17
17
  erubis (~> 2.7.0)
18
18
  journey (~> 1.0.4)
@@ -20,30 +20,31 @@ GEM
20
20
  rack-cache (~> 1.2)
21
21
  rack-test (~> 0.6.1)
22
22
  sprockets (~> 2.2.1)
23
- activemodel (3.2.17)
24
- activesupport (= 3.2.17)
23
+ activemodel (3.2.18)
24
+ activesupport (= 3.2.18)
25
25
  builder (~> 3.0.0)
26
- activerecord (3.2.17)
27
- activemodel (= 3.2.17)
28
- activesupport (= 3.2.17)
26
+ activerecord (3.2.18)
27
+ activemodel (= 3.2.18)
28
+ activesupport (= 3.2.18)
29
29
  arel (~> 3.0.2)
30
30
  tzinfo (~> 0.3.29)
31
- activeresource (3.2.17)
32
- activemodel (= 3.2.17)
33
- activesupport (= 3.2.17)
34
- activesupport (3.2.17)
31
+ activeresource (3.2.18)
32
+ activemodel (= 3.2.18)
33
+ activesupport (= 3.2.18)
34
+ activesupport (3.2.18)
35
35
  i18n (~> 0.6, >= 0.6.4)
36
36
  multi_json (~> 1.0)
37
- appraisal (0.5.2)
37
+ appraisal (1.0.2)
38
38
  bundler
39
39
  rake
40
+ thor (>= 0.14.0)
40
41
  arel (3.0.3)
41
42
  builder (3.0.4)
42
43
  coderay (1.1.0)
43
44
  diff-lcs (1.2.5)
44
45
  erubis (2.7.0)
45
46
  hike (1.2.3)
46
- i18n (0.6.9)
47
+ i18n (0.6.11)
47
48
  journey (1.0.4)
48
49
  json (1.8.1)
49
50
  mail (2.5.4)
@@ -51,11 +52,11 @@ GEM
51
52
  treetop (~> 1.4.8)
52
53
  method_source (0.8.2)
53
54
  mime-types (1.25.1)
54
- multi_json (1.9.2)
55
- polyglot (0.3.4)
56
- pry (0.9.12.6)
57
- coderay (~> 1.0)
58
- method_source (~> 0.8)
55
+ multi_json (1.10.1)
56
+ polyglot (0.3.5)
57
+ pry (0.10.1)
58
+ coderay (~> 1.1.0)
59
+ method_source (~> 0.8.1)
59
60
  slop (~> 3.4)
60
61
  rack (1.4.5)
61
62
  rack-cache (1.2)
@@ -64,37 +65,41 @@ GEM
64
65
  rack
65
66
  rack-test (0.6.2)
66
67
  rack (>= 1.0)
67
- rails (3.2.17)
68
- actionmailer (= 3.2.17)
69
- actionpack (= 3.2.17)
70
- activerecord (= 3.2.17)
71
- activeresource (= 3.2.17)
72
- activesupport (= 3.2.17)
68
+ rails (3.2.18)
69
+ actionmailer (= 3.2.18)
70
+ actionpack (= 3.2.18)
71
+ activerecord (= 3.2.18)
72
+ activeresource (= 3.2.18)
73
+ activesupport (= 3.2.18)
73
74
  bundler (~> 1.0)
74
- railties (= 3.2.17)
75
- railties (3.2.17)
76
- actionpack (= 3.2.17)
77
- activesupport (= 3.2.17)
75
+ railties (= 3.2.18)
76
+ railties (3.2.18)
77
+ actionpack (= 3.2.18)
78
+ activesupport (= 3.2.18)
78
79
  rack-ssl (~> 1.3.2)
79
80
  rake (>= 0.8.7)
80
81
  rdoc (~> 3.4)
81
82
  thor (>= 0.14.6, < 2.0)
82
- rake (10.2.2)
83
+ rake (10.3.2)
83
84
  rdoc (3.12.2)
84
85
  json (~> 1.4)
85
- rspec-core (2.99.0.beta1)
86
- rspec-expectations (2.99.0.beta1)
87
- diff-lcs (>= 1.1.3, < 2.0)
88
- rspec-mocks (2.99.0.beta1)
89
- rspec-rails (2.99.0.beta1)
86
+ rspec-core (3.0.4)
87
+ rspec-support (~> 3.0.0)
88
+ rspec-expectations (3.0.4)
89
+ diff-lcs (>= 1.2.0, < 2.0)
90
+ rspec-support (~> 3.0.0)
91
+ rspec-mocks (3.0.4)
92
+ rspec-support (~> 3.0.0)
93
+ rspec-rails (3.0.1)
90
94
  actionpack (>= 3.0)
91
- activemodel (>= 3.0)
92
95
  activesupport (>= 3.0)
93
96
  railties (>= 3.0)
94
- rspec-core (= 2.99.0.beta1)
95
- rspec-expectations (= 2.99.0.beta1)
96
- rspec-mocks (= 2.99.0.beta1)
97
- slop (3.5.0)
97
+ rspec-core (~> 3.0.0)
98
+ rspec-expectations (~> 3.0.0)
99
+ rspec-mocks (~> 3.0.0)
100
+ rspec-support (~> 3.0.0)
101
+ rspec-support (3.0.4)
102
+ slop (3.6.0)
98
103
  sprockets (2.2.2)
99
104
  hike (~> 1.2)
100
105
  multi_json (~> 1.0)
@@ -105,16 +110,16 @@ GEM
105
110
  treetop (1.4.15)
106
111
  polyglot
107
112
  polyglot (>= 0.3.1)
108
- tzinfo (0.3.39)
113
+ tzinfo (0.3.41)
109
114
 
110
115
  PLATFORMS
111
116
  ruby
112
117
 
113
118
  DEPENDENCIES
114
- appraisal (~> 0.5.2)
119
+ appraisal (= 1.0.2)
115
120
  bundler (~> 1.5)
116
121
  houser!
117
122
  pry
118
- rails (= 3.2.17)
123
+ rails (= 3.2.18)
119
124
  rake
120
- rspec-rails (= 2.99.0.beta1)
125
+ rspec-rails (= 3.0.1)
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "4.0.10"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ houser (2.0.0)
5
+ rack
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.0.10)
11
+ actionpack (= 4.0.10)
12
+ mail (~> 2.5, >= 2.5.4)
13
+ actionpack (4.0.10)
14
+ activesupport (= 4.0.10)
15
+ builder (~> 3.1.0)
16
+ erubis (~> 2.7.0)
17
+ rack (~> 1.5.2)
18
+ rack-test (~> 0.6.2)
19
+ activemodel (4.0.10)
20
+ activesupport (= 4.0.10)
21
+ builder (~> 3.1.0)
22
+ activerecord (4.0.10)
23
+ activemodel (= 4.0.10)
24
+ activerecord-deprecated_finders (~> 1.0.2)
25
+ activesupport (= 4.0.10)
26
+ arel (~> 4.0.0)
27
+ activerecord-deprecated_finders (1.0.3)
28
+ activesupport (4.0.10)
29
+ i18n (~> 0.6, >= 0.6.9)
30
+ minitest (~> 4.2)
31
+ multi_json (~> 1.3)
32
+ thread_safe (~> 0.1)
33
+ tzinfo (~> 0.3.37)
34
+ appraisal (1.0.2)
35
+ bundler
36
+ rake
37
+ thor (>= 0.14.0)
38
+ arel (4.0.2)
39
+ builder (3.1.4)
40
+ coderay (1.1.0)
41
+ diff-lcs (1.2.5)
42
+ erubis (2.7.0)
43
+ hike (1.2.3)
44
+ i18n (0.6.11)
45
+ mail (2.6.1)
46
+ mime-types (>= 1.16, < 3)
47
+ method_source (0.8.2)
48
+ mime-types (2.3)
49
+ minitest (4.7.5)
50
+ multi_json (1.10.1)
51
+ pry (0.10.1)
52
+ coderay (~> 1.1.0)
53
+ method_source (~> 0.8.1)
54
+ slop (~> 3.4)
55
+ rack (1.5.2)
56
+ rack-test (0.6.2)
57
+ rack (>= 1.0)
58
+ rails (4.0.10)
59
+ actionmailer (= 4.0.10)
60
+ actionpack (= 4.0.10)
61
+ activerecord (= 4.0.10)
62
+ activesupport (= 4.0.10)
63
+ bundler (>= 1.3.0, < 2.0)
64
+ railties (= 4.0.10)
65
+ sprockets-rails (~> 2.0)
66
+ railties (4.0.10)
67
+ actionpack (= 4.0.10)
68
+ activesupport (= 4.0.10)
69
+ rake (>= 0.8.7)
70
+ thor (>= 0.18.1, < 2.0)
71
+ rake (10.3.2)
72
+ rspec-core (3.0.4)
73
+ rspec-support (~> 3.0.0)
74
+ rspec-expectations (3.0.4)
75
+ diff-lcs (>= 1.2.0, < 2.0)
76
+ rspec-support (~> 3.0.0)
77
+ rspec-mocks (3.0.4)
78
+ rspec-support (~> 3.0.0)
79
+ rspec-rails (3.0.1)
80
+ actionpack (>= 3.0)
81
+ activesupport (>= 3.0)
82
+ railties (>= 3.0)
83
+ rspec-core (~> 3.0.0)
84
+ rspec-expectations (~> 3.0.0)
85
+ rspec-mocks (~> 3.0.0)
86
+ rspec-support (~> 3.0.0)
87
+ rspec-support (3.0.4)
88
+ slop (3.6.0)
89
+ sprockets (2.12.2)
90
+ hike (~> 1.2)
91
+ multi_json (~> 1.0)
92
+ rack (~> 1.0)
93
+ tilt (~> 1.1, != 1.3.0)
94
+ sprockets-rails (2.1.4)
95
+ actionpack (>= 3.0)
96
+ activesupport (>= 3.0)
97
+ sprockets (~> 2.8)
98
+ thor (0.19.1)
99
+ thread_safe (0.3.4)
100
+ tilt (1.4.1)
101
+ tzinfo (0.3.41)
102
+
103
+ PLATFORMS
104
+ ruby
105
+
106
+ DEPENDENCIES
107
+ appraisal (= 1.0.2)
108
+ bundler (~> 1.5)
109
+ houser!
110
+ pry
111
+ rails (= 4.0.10)
112
+ rake
113
+ rspec-rails (= 3.0.1)
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "4.0.4"
5
+ gem "rails", "4.1.2"
6
6
 
7
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -0,0 +1,124 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ houser (2.0.0)
5
+ rack
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.1.2)
11
+ actionpack (= 4.1.2)
12
+ actionview (= 4.1.2)
13
+ mail (~> 2.5.4)
14
+ actionpack (4.1.2)
15
+ actionview (= 4.1.2)
16
+ activesupport (= 4.1.2)
17
+ rack (~> 1.5.2)
18
+ rack-test (~> 0.6.2)
19
+ actionview (4.1.2)
20
+ activesupport (= 4.1.2)
21
+ builder (~> 3.1)
22
+ erubis (~> 2.7.0)
23
+ activemodel (4.1.2)
24
+ activesupport (= 4.1.2)
25
+ builder (~> 3.1)
26
+ activerecord (4.1.2)
27
+ activemodel (= 4.1.2)
28
+ activesupport (= 4.1.2)
29
+ arel (~> 5.0.0)
30
+ activesupport (4.1.2)
31
+ i18n (~> 0.6, >= 0.6.9)
32
+ json (~> 1.7, >= 1.7.7)
33
+ minitest (~> 5.1)
34
+ thread_safe (~> 0.1)
35
+ tzinfo (~> 1.1)
36
+ appraisal (1.0.2)
37
+ bundler
38
+ rake
39
+ thor (>= 0.14.0)
40
+ arel (5.0.1.20140414130214)
41
+ builder (3.2.2)
42
+ coderay (1.1.0)
43
+ diff-lcs (1.2.5)
44
+ erubis (2.7.0)
45
+ hike (1.2.3)
46
+ i18n (0.6.11)
47
+ json (1.8.1)
48
+ mail (2.5.4)
49
+ mime-types (~> 1.16)
50
+ treetop (~> 1.4.8)
51
+ method_source (0.8.2)
52
+ mime-types (1.25.1)
53
+ minitest (5.4.1)
54
+ multi_json (1.10.1)
55
+ polyglot (0.3.5)
56
+ pry (0.10.1)
57
+ coderay (~> 1.1.0)
58
+ method_source (~> 0.8.1)
59
+ slop (~> 3.4)
60
+ rack (1.5.2)
61
+ rack-test (0.6.2)
62
+ rack (>= 1.0)
63
+ rails (4.1.2)
64
+ actionmailer (= 4.1.2)
65
+ actionpack (= 4.1.2)
66
+ actionview (= 4.1.2)
67
+ activemodel (= 4.1.2)
68
+ activerecord (= 4.1.2)
69
+ activesupport (= 4.1.2)
70
+ bundler (>= 1.3.0, < 2.0)
71
+ railties (= 4.1.2)
72
+ sprockets-rails (~> 2.0)
73
+ railties (4.1.2)
74
+ actionpack (= 4.1.2)
75
+ activesupport (= 4.1.2)
76
+ rake (>= 0.8.7)
77
+ thor (>= 0.18.1, < 2.0)
78
+ rake (10.3.2)
79
+ rspec-core (3.0.4)
80
+ rspec-support (~> 3.0.0)
81
+ rspec-expectations (3.0.4)
82
+ diff-lcs (>= 1.2.0, < 2.0)
83
+ rspec-support (~> 3.0.0)
84
+ rspec-mocks (3.0.4)
85
+ rspec-support (~> 3.0.0)
86
+ rspec-rails (3.0.1)
87
+ actionpack (>= 3.0)
88
+ activesupport (>= 3.0)
89
+ railties (>= 3.0)
90
+ rspec-core (~> 3.0.0)
91
+ rspec-expectations (~> 3.0.0)
92
+ rspec-mocks (~> 3.0.0)
93
+ rspec-support (~> 3.0.0)
94
+ rspec-support (3.0.4)
95
+ slop (3.6.0)
96
+ sprockets (2.12.2)
97
+ hike (~> 1.2)
98
+ multi_json (~> 1.0)
99
+ rack (~> 1.0)
100
+ tilt (~> 1.1, != 1.3.0)
101
+ sprockets-rails (2.1.4)
102
+ actionpack (>= 3.0)
103
+ activesupport (>= 3.0)
104
+ sprockets (~> 2.8)
105
+ thor (0.19.1)
106
+ thread_safe (0.3.4)
107
+ tilt (1.4.1)
108
+ treetop (1.4.15)
109
+ polyglot
110
+ polyglot (>= 0.3.1)
111
+ tzinfo (1.2.2)
112
+ thread_safe (~> 0.1)
113
+
114
+ PLATFORMS
115
+ ruby
116
+
117
+ DEPENDENCIES
118
+ appraisal (= 1.0.2)
119
+ bundler (~> 1.5)
120
+ houser!
121
+ pry
122
+ rails (= 4.1.2)
123
+ rake
124
+ rspec-rails (= 3.0.1)
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.5"
24
24
  spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rspec-rails", "2.99.0.beta1"
25
+ spec.add_development_dependency "rspec-rails", "3.0.1"
26
26
  spec.add_development_dependency "pry"
27
- spec.add_development_dependency 'appraisal', '~> 0.5.2'
27
+ spec.add_development_dependency 'appraisal', '1.0.2'
28
28
  end
@@ -27,11 +27,11 @@ module Houser
27
27
  private
28
28
 
29
29
  def find_tenant(env, subdomain)
30
- object = options[:class].where(options[:subdomain_column].to_sym => subdomain).first
30
+ object = options[:class].where(options[:subdomain_column] => subdomain).first
31
31
  if object
32
- env['X-Houser-Subdomain'] = subdomain
33
- env['X-Houser-Object'] = object
32
+ env['Houser-Subdomain'] = subdomain
33
+ env['Houser-Object'] = object
34
34
  end
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module Houser
2
- VERSION = "1.1.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -29,35 +29,35 @@ describe Houser::Middleware do
29
29
  it "does nothing for non-subdomained requests" do
30
30
  expect(Account).to_not receive(:where)
31
31
  code, env = middleware.call(env_for("http://example.com"))
32
- expect(env['X-Houser-Subdomain']).to be_nil
33
- expect(env['X-Houser-Object']).to be_nil
32
+ expect(env['Houser-Subdomain']).to be_nil
33
+ expect(env['Houser-Object']).to be_nil
34
34
  end
35
35
 
36
- it "sets X-HOUSER-ID header for known subdomains" do
36
+ it "sets Houser-ID header for known subdomains" do
37
37
  account = double(id: 1)
38
- expect(Account).to receive(:where).with(subdomain: subdomain).and_return([account])
38
+ expect(Account).to receive(:where).with("subdomain" => subdomain).and_return([account])
39
39
  code, env = middleware.call(env_for("http://#{subdomain}.example.com"))
40
- expect(env['X-Houser-Subdomain']).to eq(subdomain)
41
- expect(env['X-Houser-Object']).to eq(account)
40
+ expect(env['Houser-Subdomain']).to eq(subdomain)
41
+ expect(env['Houser-Object']).to eq(account)
42
42
  end
43
43
 
44
44
  it "returns no headers for unknown subdomains" do
45
- expect(Account).to receive(:where).with(subdomain: subdomain).and_return([])
45
+ expect(Account).to receive(:where).with("subdomain" => subdomain).and_return([])
46
46
  code, env = middleware.call(env_for("http://#{subdomain}.example.com"))
47
- expect(env['X-Houser-Subdomain']).to be_nil
48
- expect(env['X-Houser-Object']).to be_nil
47
+ expect(env['Houser-Subdomain']).to be_nil
48
+ expect(env['Houser-Object']).to be_nil
49
49
  end
50
50
 
51
51
 
52
52
  context "double subdomain" do
53
53
  let(:subdomain) { 'ruby.melbourne' }
54
54
 
55
- it "sets X-HOUSER-ID header for known subdomains within subdomains" do
55
+ it "sets Houser-ID header for known subdomains within subdomains" do
56
56
  account = double(id: 1)
57
- expect(Account).to receive(:where).with(subdomain: subdomain).and_return([account])
57
+ expect(Account).to receive(:where).with("subdomain" => subdomain).and_return([account])
58
58
  code, env = middleware.call(env_for("http://#{subdomain}.example.com"))
59
- expect(env['X-Houser-Subdomain']).to eq(subdomain)
60
- expect(env['X-Houser-Object']).to eq(account)
59
+ expect(env['Houser-Subdomain']).to eq(subdomain)
60
+ expect(env['Houser-Object']).to eq(account)
61
61
  end
62
62
  end
63
63
 
@@ -76,10 +76,10 @@ describe Houser::Middleware do
76
76
 
77
77
  it "calls the right class" do
78
78
  expect(Account).to_not receive(:where)
79
- expect(Store).to receive(:where).with(subdomain: subdomain).and_return([store])
79
+ expect(Store).to receive(:where).with("subdomain" => subdomain).and_return([store])
80
80
  code, env = middleware.call(env_for("http://#{subdomain}.example.com"))
81
- expect(env['X-Houser-Subdomain']).to eq(subdomain)
82
- expect(env['X-Houser-Object']).to eq(store)
81
+ expect(env['Houser-Subdomain']).to eq(subdomain)
82
+ expect(env['Houser-Object']).to eq(store)
83
83
  end
84
84
  end
85
85
 
@@ -94,19 +94,19 @@ describe Houser::Middleware do
94
94
  it "supports more than one-level of TLD" do
95
95
  expect(Account).to_not receive(:where)
96
96
  code, env = middleware.call(env_for("http://example.co.uk"))
97
- expect(env['X-Houser-Subdomain']).to be_nil
98
- expect(env['X-Houser-ID']).to be_nil
97
+ expect(env['Houser-Subdomain']).to be_nil
98
+ expect(env['Houser-ID']).to be_nil
99
99
  end
100
100
 
101
101
  context "double subdomain" do
102
102
  let(:subdomain) { 'ruby.melbourne' }
103
103
 
104
- it "sets X-HOUSER-ID header for known subdomains within subdomains" do
104
+ it "sets Houser-ID header for known subdomains within subdomains" do
105
105
  account = double(id: 1)
106
- expect(Account).to receive(:where).with(subdomain: subdomain).and_return([account])
106
+ expect(Account).to receive(:where).with("subdomain" => subdomain).and_return([account])
107
107
  code, env = middleware.call(env_for("http://#{subdomain}.example.co.uk"))
108
- expect(env['X-Houser-Subdomain']).to eq(subdomain)
109
- expect(env['X-Houser-Object']).to eq(account)
108
+ expect(env['Houser-Subdomain']).to eq(subdomain)
109
+ expect(env['Houser-Object']).to eq(account)
110
110
  end
111
111
  end
112
112
  end
@@ -121,10 +121,10 @@ describe Houser::Middleware do
121
121
 
122
122
  it "finds by an alternative column" do
123
123
  account = double(id: 1)
124
- expect(Account).to receive(:where).with(:foo => subdomain).and_return([account])
124
+ expect(Account).to receive(:where).with("foo" => subdomain).and_return([account])
125
125
  code, env = middleware.call(env_for("http://#{subdomain}.example.com"))
126
- expect(env['X-Houser-Subdomain']).to eq(subdomain)
127
- expect(env['X-Houser-Object']).to eq(account)
126
+ expect(env['Houser-Subdomain']).to eq(subdomain)
127
+ expect(env['Houser-Object']).to eq(account)
128
128
  end
129
129
  end
130
130
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: houser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-28 00:00:00.000000000 Z
11
+ date: 2014-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 2.99.0.beta1
61
+ version: 3.0.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 2.99.0.beta1
68
+ version: 3.0.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: appraisal
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 0.5.2
89
+ version: 1.0.2
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 0.5.2
96
+ version: 1.0.2
97
97
  description: Lightweight multitenancy gem.
98
98
  email:
99
99
  - radarlistener@gmail.com
@@ -104,6 +104,7 @@ files:
104
104
  - ".gitignore"
105
105
  - ".travis.yml"
106
106
  - Appraisals
107
+ - CHANGELOG.md
107
108
  - CONTRIBUTING.md
108
109
  - Gemfile
109
110
  - LICENSE.txt
@@ -111,8 +112,10 @@ files:
111
112
  - Rakefile
112
113
  - gemfiles/rails3.gemfile
113
114
  - gemfiles/rails3.gemfile.lock
114
- - gemfiles/rails4.gemfile
115
- - gemfiles/rails4.gemfile.lock
115
+ - gemfiles/rails4.0.gemfile
116
+ - gemfiles/rails4.0.gemfile.lock
117
+ - gemfiles/rails4.1.gemfile
118
+ - gemfiles/rails4.1.gemfile.lock
116
119
  - houser.gemspec
117
120
  - lib/houser.rb
118
121
  - lib/houser/middleware.rb
@@ -138,9 +141,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
141
  version: '0'
139
142
  requirements: []
140
143
  rubyforge_project:
141
- rubygems_version: 2.2.0
144
+ rubygems_version: 2.2.2
142
145
  signing_key:
143
146
  specification_version: 4
144
147
  summary: Lightweight multitenancy gem.
145
148
  test_files:
146
149
  - spec/houser_spec.rb
150
+ has_rdoc:
@@ -1,115 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- houser (1.0.2)
5
- rack
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- actionmailer (4.0.4)
11
- actionpack (= 4.0.4)
12
- mail (~> 2.5.4)
13
- actionpack (4.0.4)
14
- activesupport (= 4.0.4)
15
- builder (~> 3.1.0)
16
- erubis (~> 2.7.0)
17
- rack (~> 1.5.2)
18
- rack-test (~> 0.6.2)
19
- activemodel (4.0.4)
20
- activesupport (= 4.0.4)
21
- builder (~> 3.1.0)
22
- activerecord (4.0.4)
23
- activemodel (= 4.0.4)
24
- activerecord-deprecated_finders (~> 1.0.2)
25
- activesupport (= 4.0.4)
26
- arel (~> 4.0.0)
27
- activerecord-deprecated_finders (1.0.3)
28
- activesupport (4.0.4)
29
- i18n (~> 0.6, >= 0.6.9)
30
- minitest (~> 4.2)
31
- multi_json (~> 1.3)
32
- thread_safe (~> 0.1)
33
- tzinfo (~> 0.3.37)
34
- appraisal (0.5.2)
35
- bundler
36
- rake
37
- arel (4.0.2)
38
- atomic (1.1.16)
39
- builder (3.1.4)
40
- coderay (1.1.0)
41
- diff-lcs (1.2.5)
42
- erubis (2.7.0)
43
- hike (1.2.3)
44
- i18n (0.6.9)
45
- mail (2.5.4)
46
- mime-types (~> 1.16)
47
- treetop (~> 1.4.8)
48
- method_source (0.8.2)
49
- mime-types (1.25.1)
50
- minitest (4.7.5)
51
- multi_json (1.9.2)
52
- polyglot (0.3.4)
53
- pry (0.9.12.6)
54
- coderay (~> 1.0)
55
- method_source (~> 0.8)
56
- slop (~> 3.4)
57
- rack (1.5.2)
58
- rack-test (0.6.2)
59
- rack (>= 1.0)
60
- rails (4.0.4)
61
- actionmailer (= 4.0.4)
62
- actionpack (= 4.0.4)
63
- activerecord (= 4.0.4)
64
- activesupport (= 4.0.4)
65
- bundler (>= 1.3.0, < 2.0)
66
- railties (= 4.0.4)
67
- sprockets-rails (~> 2.0.0)
68
- railties (4.0.4)
69
- actionpack (= 4.0.4)
70
- activesupport (= 4.0.4)
71
- rake (>= 0.8.7)
72
- thor (>= 0.18.1, < 2.0)
73
- rake (10.2.2)
74
- rspec-core (2.99.0.beta1)
75
- rspec-expectations (2.99.0.beta1)
76
- diff-lcs (>= 1.1.3, < 2.0)
77
- rspec-mocks (2.99.0.beta1)
78
- rspec-rails (2.99.0.beta1)
79
- actionpack (>= 3.0)
80
- activemodel (>= 3.0)
81
- activesupport (>= 3.0)
82
- railties (>= 3.0)
83
- rspec-core (= 2.99.0.beta1)
84
- rspec-expectations (= 2.99.0.beta1)
85
- rspec-mocks (= 2.99.0.beta1)
86
- slop (3.5.0)
87
- sprockets (2.12.0)
88
- hike (~> 1.2)
89
- multi_json (~> 1.0)
90
- rack (~> 1.0)
91
- tilt (~> 1.1, != 1.3.0)
92
- sprockets-rails (2.0.1)
93
- actionpack (>= 3.0)
94
- activesupport (>= 3.0)
95
- sprockets (~> 2.8)
96
- thor (0.19.1)
97
- thread_safe (0.3.1)
98
- atomic (>= 1.1.7, < 2)
99
- tilt (1.4.1)
100
- treetop (1.4.15)
101
- polyglot
102
- polyglot (>= 0.3.1)
103
- tzinfo (0.3.39)
104
-
105
- PLATFORMS
106
- ruby
107
-
108
- DEPENDENCIES
109
- appraisal (~> 0.5.2)
110
- bundler (~> 1.5)
111
- houser!
112
- pry
113
- rails (= 4.0.4)
114
- rake
115
- rspec-rails (= 2.99.0.beta1)