subdomain_locale 1.0.beta3 → 1.0.beta4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e922108abe3424f50377edcecfb7e50859500e0
4
- data.tar.gz: 398d5cc593c29b115b2d64f60e9ae910e5edda8f
3
+ metadata.gz: fdc1524b2a958bfe398f7f91a1f6d1890008aab9
4
+ data.tar.gz: fac92758a062f7d198f9c474424be5742838abf9
5
5
  SHA512:
6
- metadata.gz: bce28543d5379b27d6e86b050a642dd331d804f0b310e0986f89f166490f6fb49274481ba0db02bf9730d02a86be91eb507f834fc4e9541b8bdaaaf5527f2ad4
7
- data.tar.gz: 8b763460ecc07a8f1aa178c656a8e2a81ffc3e2fad73beea839a669390ba68754a6cb9ff287d985d3f5a3d69a1faa34b0fb296eb794b564002030357f5bcea61
6
+ metadata.gz: 85ba896d50772f6e452bfb6142eb71f6ecc0fe6ecae13e1e2fa474e3dddcc9df47840b57a2f1beb088c547d9d3f4aa7c3871ffb76adb2d30975facb6a94d8c6c
7
+ data.tar.gz: e84bfe39c6bc408828f14e186edde19a0c971588ef6b5af867a78639573bbb1d11d6f000b9e0be91d8558cca1fe03f941de81a52c1ee6631bcb282425e6a1dcc
@@ -24,7 +24,7 @@ module SubdomainLocale
24
24
  end
25
25
 
26
26
  def subdomain_for(locale)
27
- locale and @repository.invert.fetch(locale.to_s, locale.to_s).presence
27
+ locale and @repository.invert.fetch(locale.to_s, locale.to_s).presence or false
28
28
  end
29
29
  end
30
30
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "subdomain_locale"
5
- spec.version = "1.0.beta3"
5
+ spec.version = "1.0.beta4"
6
6
  spec.authors = ["Semyon Perepelitsa"]
7
7
  spec.email = ["sema@sema.in"]
8
8
  spec.summary = "Set I18n locale based on subdomain"
data/test/mapping_test.rb CHANGED
@@ -21,11 +21,13 @@ class MappingTest < MiniTest::Unit::TestCase
21
21
  # request.subdomain returns "" for test.host
22
22
  assert_equal "en", @mapping.locale_for("")
23
23
 
24
- # "" results in .test.host, nil produces correct test.host
25
- assert_equal nil, @mapping.subdomain_for(:en)
24
+ # url_for(subdomain: "") => ".test.host"
25
+ # url_for(subdomain: nil) => "test.host" in Rails 4, "current.test.host" in Rails 3
26
+ # url_for(subdomain: false) => "test.host"
27
+ assert_equal false, @mapping.subdomain_for(:en)
26
28
  end
27
29
 
28
30
  def test_nil
29
- assert_nil @mapping.subdomain_for(nil)
31
+ assert_equal false, @mapping.subdomain_for(nil)
30
32
  end
31
33
  end
data/test/rails_test.rb CHANGED
@@ -3,7 +3,7 @@ require_relative "test_helper"
3
3
 
4
4
  class HelloControllerTest < ActionController::TestCase
5
5
  def test_links
6
- @request.host = "example.com"
6
+ @request.host = "ru.example.com"
7
7
  get :world
8
8
  menu = css_select("menu a")
9
9
  assert_equal "/", menu[0]["href"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subdomain_locale
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.beta3
4
+ version: 1.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Semyon Perepelitsa