wovnrb 0.2.07 → 0.2.07.1

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: 475d239f4c2bc99bb2e55c39fddb2b44bde9cb4b
4
- data.tar.gz: 4210964a50e17d64df9e5419049d2fa88ef73d9f
3
+ metadata.gz: b65bd099a98b9832deb8a8ad6c0a76b2442727ec
4
+ data.tar.gz: 2d65eb16175398584a2bebe3f80732d74d7cc3ec
5
5
  SHA512:
6
- metadata.gz: 9ebfaa9a32f5da6db1ac44e41b0222f609f6fefa1a900db1ccbe394c9807376be12b036b6b9a0ec53d2f1b2a154e29724c09815c628bf7cb7d22667619e5736f
7
- data.tar.gz: 21281afc06d1922f57349a374c7296f83fb7aa09534aa718e8a55a5e498913d9446ef8a03cc2630c43ed7f6bc394b510eeeebd6e52fead0c3ec1f8f71b9154e3
6
+ metadata.gz: 629628750b2196824f4e2be03e0f299f94989d115fc1042a43adc146f22d627d3dbabc78435f39e25d473cef2c72ac6449766ca2779e51c54082e4b12fa681c4
7
+ data.tar.gz: fa5f22df24ad7726ab9a056718a0ac037ae95482142de2dc6e834a59d55d369398b584125bcb938b6c3a7d3d09d2ceff839e73f1ec6f68294bf4925ff43c8255
@@ -205,7 +205,7 @@ module Wovnrb
205
205
 
206
206
  def out(headers)
207
207
  r = Regexp.new("//" + @host)
208
- if headers.has_key?("Location") && headers["Location"] =~ r
208
+ if lang_code != @settings['default_lang'] && headers.has_key?("Location") && headers["Location"] =~ r
209
209
  case @settings['url_pattern']
210
210
  when 'query'
211
211
  if headers["Location"] =~ /\?/
@@ -1,3 +1,3 @@
1
1
  module Wovnrb
2
- VERSION = "0.2.07"
2
+ VERSION = "0.2.07.1"
3
3
  end
@@ -150,6 +150,60 @@ class HeadersTest < Minitest::Test
150
150
  assert_equal('http://wovn.io/test', env['HTTP_REFERER'])
151
151
  end
152
152
 
153
+ def test_out_original_lang_with_subdomain_url_pattern
154
+ h = Wovnrb::Headers.new(
155
+ Wovnrb.get_env(
156
+ 'SERVER_NAME' => 'wovn.io',
157
+ 'REQUEST_URI' => '/test',
158
+ 'HTTP_REFERER' => 'http://wovn.io/test',
159
+ ),
160
+ Wovnrb.get_settings(
161
+ 'url_pattern' => 'subdomain',
162
+ 'url_pattern_reg' => '^(?<lang>[^.]+).',
163
+ ),
164
+ )
165
+ headers = h.request_out(h.lang_code)
166
+ assert_equal('http://wovn.io/test', headers['HTTP_REFERER'])
167
+ headers['Location'] = headers['HTTP_REFERER']
168
+ assert_equal('http://wovn.io/test', h.out(headers)['Location'])
169
+ end
170
+
171
+ def test_out_original_lang_with_path_url_pattern
172
+ h = Wovnrb::Headers.new(
173
+ Wovnrb.get_env(
174
+ 'SERVER_NAME' => 'wovn.io',
175
+ 'REQUEST_URI' => '/test',
176
+ 'HTTP_REFERER' => 'http://wovn.io/test',
177
+ ),
178
+ Wovnrb.get_settings(
179
+ 'url_pattern' => 'path',
180
+ 'url_pattern_reg' => '/(?<lang>[^/.?]+)',
181
+ ),
182
+ )
183
+ headers = h.request_out(h.lang_code)
184
+ assert_equal('http://wovn.io/test', headers['HTTP_REFERER'])
185
+ headers['Location'] = headers['HTTP_REFERER']
186
+ assert_equal('http://wovn.io/test', h.out(headers)['Location'])
187
+ end
188
+
189
+ def test_out_original_lang_with_query_url_pattern
190
+ h = Wovnrb::Headers.new(
191
+ Wovnrb.get_env(
192
+ 'SERVER_NAME' => 'wovn.io',
193
+ 'REQUEST_URI' => '/test',
194
+ 'HTTP_REFERER' => 'http://wovn.io/test',
195
+ ),
196
+ Wovnrb.get_settings(
197
+ 'url_pattern' => 'query',
198
+ 'url_pattern_reg' => '((\\?.*&)|\\?)wovn=(?<lang>[^&]+)(&|$)',
199
+ ),
200
+ )
201
+ headers = h.request_out(h.lang_code)
202
+ assert_equal('http://wovn.io/test', headers['HTTP_REFERER'])
203
+ headers['Location'] = headers['HTTP_REFERER']
204
+ assert_equal('http://wovn.io/test', h.out(headers)['Location'])
205
+ end
206
+
153
207
  #########################
154
208
  # GET SETTINGS
155
209
  #########################
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wovnrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.07
4
+ version: 0.2.07.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Sandford
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-29 00:00:00.000000000 Z
12
+ date: 2017-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogumbo
@@ -388,4 +388,3 @@ test_files:
388
388
  - test/lib/wovnrb_test.rb
389
389
  - test/services/url_test.rb
390
390
  - test/test_helper.rb
391
- has_rdoc: