tenantify 0.0.1 → 0.0.2

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: 8c5ba9f063bf0b429174f9c8e1c0ec83c7502bf8
4
- data.tar.gz: 90a9332da5ce0b6a1ff840181ab141c45a3bf45c
3
+ metadata.gz: 1c8c42f9166c61f4cb6d478a4365f6c83e764a78
4
+ data.tar.gz: 5cdf09bd05953384efc79a95501a37196ec830ce
5
5
  SHA512:
6
- metadata.gz: fff72aa956ebf8afcd1d6129a2b6114743b0514b3d79d01036cc85c32464e239e02341d1536d1c2fa3f9b945bbd8e19e9d0655df8f02728b8b372adf1fcbec25
7
- data.tar.gz: 9f18246005abc4e3d0580ec40b443cc4b591e1c306e4c13747a701ce3cdb16d49139dbb8cf5ff90e29fc20f4459dd805418ec25f3405f6ddd7eb24502416273f
6
+ metadata.gz: a824126f2549f1808cb896344640407869dfed1d465c5e109677cbd05f74bca65b69eeb9ce94a48386b578df0029541cfbc0152f1c41f927c541f7190e357c84
7
+ data.tar.gz: a8ac937a975ab177eb65689b753525d592b9058c178061e7b4a08394125f0d1b7be58db2239293e598896d6bb1c20f23ab574828ec1db2fee750ff3a3177c9db
@@ -34,7 +34,7 @@ module Tenantify
34
34
  attr_reader :config
35
35
 
36
36
  def tenant
37
- @tenant ||= config.fetch(:tenant) { raise_error }.to_sym
37
+ @tenant ||= config.fetch(:tenant) { raise_error }
38
38
  end
39
39
 
40
40
  def raise_error
@@ -30,9 +30,7 @@ module Tenantify
30
30
  # @param [rack_environment] the rack environment.
31
31
  # @return [Symbol, nil] the found tenant of nil.
32
32
  def tenant_for env
33
- tenant = env[header_name]
34
-
35
- tenant.to_sym if tenant
33
+ env[header_name]
36
34
  end
37
35
 
38
36
  private
@@ -30,10 +30,9 @@ module Tenantify
30
30
  # @param [rack_environment] the rack environment.
31
31
  # @return [Symbol, nil] the found tenant of nil.
32
32
  def tenant_for env
33
- host = env["SERVER_NAME"]
34
- tenant = correspondence[host]
33
+ host = env["SERVER_NAME"]
35
34
 
36
- tenant.to_sym if tenant
35
+ correspondence[host]
37
36
  end
38
37
 
39
38
  private
@@ -1,5 +1,5 @@
1
1
  module Tenantify
2
2
 
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
 
5
5
  end
@@ -21,7 +21,7 @@ RSpec.describe "One middleware strategy" do
21
21
  # Valid env
22
22
  expect(app).to receive :call do |env|
23
23
  expect(env).to eq env
24
- expect(Tenantify.current).to eq :a_tenant
24
+ expect(Tenantify.current).to eq 'a_tenant'
25
25
 
26
26
  response
27
27
  end
@@ -10,7 +10,7 @@ RSpec.describe Tenantify::Middleware::Strategies::Default do
10
10
  let(:env) { double 'env' }
11
11
 
12
12
  it 'returns the same tenant for any env' do
13
- expect(subject.tenant_for(env)).to eq :the_tenant
13
+ expect(subject.tenant_for(env)).to eq 'the_tenant'
14
14
  end
15
15
  end
16
16
 
@@ -11,7 +11,7 @@ RSpec.describe Tenantify::Middleware::Strategies::Header do
11
11
  let(:env) { {'X-Tenant' => 'the_tenant'} }
12
12
 
13
13
  it 'returns the header content' do
14
- expect(subject.tenant_for(env)).to eq :the_tenant
14
+ expect(subject.tenant_for(env)).to eq 'the_tenant'
15
15
  end
16
16
  end
17
17
 
@@ -16,7 +16,7 @@ RSpec.describe Tenantify::Middleware::Strategies::Host do
16
16
  let(:env) { {"SERVER_NAME" => 'www.host_c.com'} }
17
17
 
18
18
  it 'chooses the proper tenant' do
19
- expect(subject.tenant_for(env)).to eq :tenant_2
19
+ expect(subject.tenant_for(env)).to eq 'tenant_2'
20
20
  end
21
21
  end
22
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenantify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Cabot Campins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler