dragoman 0.0.1 → 0.0.2

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: 127dbccea787a7238a460c76d61ee6b0fcc90c9f
4
- data.tar.gz: 0e75c1d8df90190e98f30f88364ea39d42e47803
3
+ metadata.gz: 4090b145af56cf395749d4563c858dc9d7ec438e
4
+ data.tar.gz: 4f1f281ed36a13365785fafa7eb487157372db5e
5
5
  SHA512:
6
- metadata.gz: 4f23021dd1c0377525fb59ef808df8ba0ad8e958eab803231c7c0fc8b14f082dcfdca8ed21d92783557d1d4aae4d53f6d5ca9c9b6b9858362038de2484bb774e
7
- data.tar.gz: 6a6507b47d6dfde740485eebdf91085c36209c8c237d2abe67ae3283d6801dac83ac9f8fd6e532eff5a7ad3f74ee6a996f68d83befdcf689b20c3098b69440c3
6
+ metadata.gz: 4000a0878013f2345310d757ab55e0d98d3862021f632a0bb1220f3ea0596133be2840a88aba3ceb418ce3007769e245e624e8aa2826ea9fc757cd2c14bad75e
7
+ data.tar.gz: ffd681555d10500818eeefa7858ca2b9ff3df0dc3e326a2d203fa7e522f9a262d309bee554aecd475fd94589cdc00c1901396a80923329525012faad35083a1d
@@ -26,7 +26,7 @@ module Dragoman
26
26
 
27
27
  def add_route_with_localization(action, options)
28
28
  if @current_locale
29
- options[:path] = Dragoman::Translator.translate_path(action, @current_locale) unless canonical_action?(action)
29
+ options[:path] = Dragoman::Translator.translate_path(action, @current_locale) if action.present? && !canonical_action?(action)
30
30
  options[:locale] = @current_locale
31
31
  end
32
32
  add_route_without_localization action, options
@@ -29,7 +29,7 @@ module Dragoman
29
29
 
30
30
  def add_route_with_localization(action, options)
31
31
  if @current_locale
32
- options[:path] = Dragoman::Translator.translate_path(action, @current_locale) unless canonical_action?(action, true)
32
+ options[:path] = Dragoman::Translator.translate_path(action, @current_locale) if action.present? && !canonical_action?(action, true)
33
33
  options[:locale] = @current_locale
34
34
  end
35
35
  add_route_without_localization action, options
@@ -1,3 +1,3 @@
1
1
  module Dragoman
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -12,6 +12,8 @@ Dummy::Application.routes.draw do
12
12
 
13
13
  resources :products
14
14
  resource :account
15
+
16
+ get '' => 'application#test', as: 'empty'
15
17
  end
16
18
 
17
19
  end
@@ -45,6 +45,11 @@ describe 'routes' do
45
45
  assert_routing '/products', :controller => 'products', :action => 'index', :locale => :en
46
46
  end
47
47
 
48
+ it 'skips empty paths' do
49
+ expect(empty_nl_path).to eq '/'
50
+ expect(empty_en_path).to eq '/'
51
+ end
52
+
48
53
  describe 'adds untranslated path helpers' do
49
54
  it 'uses the I18n locale' do
50
55
  I18n.locale = :nl
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragoman
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
  - Pieter Visser