rewritten 0.13.0 → 0.13.1
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 +4 -4
- data/HISTORY.rdoc +3 -0
- data/lib/rewritten/version.rb +1 -1
- data/lib/rewritten.rb +2 -3
- data/test/rewritten_test.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec0125862e538037c12d709768eda65cf08e3cb6
|
4
|
+
data.tar.gz: d02def0f2df7280603224f60e4c709844c1b56fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c02e89f98798a7e84e2bab137f3ef0d54c99376928adaac861c398434df0c18704155ca4b7bd4a9860df4bd169443b08a9b585d6ccef682148c6ed8306a84012
|
7
|
+
data.tar.gz: a4d30fd8357c5ff63cac5de1592d52c3cc0bf95450d1da298ed68b12a602de080cb36206f6dbd7577f04975d0cb233966825dc6387454f3dcb53b55dd1f1c6d4
|
data/HISTORY.rdoc
CHANGED
data/lib/rewritten/version.rb
CHANGED
data/lib/rewritten.rb
CHANGED
@@ -196,11 +196,10 @@ module Rewritten
|
|
196
196
|
translation = Rewritten.z_range("to:#{uri.path}", -1)
|
197
197
|
end
|
198
198
|
|
199
|
-
|
200
|
-
|
199
|
+
# return path as is if no translation found
|
200
|
+
return path unless translation
|
201
201
|
|
202
202
|
translated_uri = URI.parse(translation)
|
203
|
-
|
204
203
|
uri.path = translated_uri.path
|
205
204
|
uri.query = [translated_uri.query, uri.query].compact.join('&')
|
206
205
|
uri.query = nil if uri.query == ''
|
data/test/rewritten_test.rb
CHANGED
@@ -25,6 +25,10 @@ describe Rewritten do
|
|
25
25
|
Rewritten.get_current_translation('/to_without_params?some=param').must_equal '/from_without_params?some=param'
|
26
26
|
end
|
27
27
|
|
28
|
+
it "must not add parameters twice if no translation is found" do
|
29
|
+
Rewritten.get_current_translation('/no/translation?some=param').must_equal '/no/translation?some=param'
|
30
|
+
end
|
31
|
+
|
28
32
|
it "must translate if protocol and host are given" do
|
29
33
|
Rewritten.add_translation('/from_without_params', '/to_without_params')
|
30
34
|
Rewritten.get_current_translation('http://localhost:3000/to_without_params').must_equal 'http://localhost:3000/from_without_params'
|